Click here to Skip to main content
15,905,963 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Screen size and Form size Pin
Dave Kreskowiak30-Oct-16 17:53
mveDave Kreskowiak30-Oct-16 17:53 
AnswerRe: Screen size and Form size Pin
Mycroft Holmes30-Oct-16 17:31
professionalMycroft Holmes30-Oct-16 17:31 
QuestionAn easy way of implementing INotifyPropertyChanged on entity Framework Pin
desanti27-Oct-16 14:58
desanti27-Oct-16 14:58 
AnswerRe: An easy way of implementing INotifyPropertyChanged on entity Framework Pin
Brisingr Aerowing27-Oct-16 16:11
professionalBrisingr Aerowing27-Oct-16 16:11 
QuestionEntity Framework : Save new object and new childs Pin
desanti27-Oct-16 7:22
desanti27-Oct-16 7:22 
AnswerRe: Entity Framework : Save new object and new childs Pin
Dave Kreskowiak27-Oct-16 11:04
mveDave Kreskowiak27-Oct-16 11:04 
GeneralRe: Entity Framework : Save new object and new childs Pin
desanti27-Oct-16 14:53
desanti27-Oct-16 14:53 
GeneralRe: Entity Framework : Save new object and new childs Pin
Dave Kreskowiak28-Oct-16 9:44
mveDave Kreskowiak28-Oct-16 9:44 
OK, in your first code snippet, you do NOT new up a List object. You use the existing HashSet object you created in your MyObject class:
VB
Using context As New MyObjectContext

    Dim obj1 As New MyObject
    obj1.nm = "123"
    obj1.value = 25

    Dim child1 As New ChildObject
    child1.name = "abc"
    child1.vl = "efd"

    obj1.ChildObjects.Add(child1)

    context.MyObjects.Add(obj1)

    context.SaveChanges()
End Using

You also do not need the Public Property MyObjectId As Integer line in the ChildObject class definition. EF will create this field automatically:
VB
Public Class ChildObject
    Public Property id As Integer
    Public Property name As String
    Public Property vl As String
    Public Property MyObjectId As Integer <-- remove this line
    Public Overridable Property MyObject As MyObject

A guide to posting questions on CodeProject

Click this: Asking questions is a skill.
Seriously, do it.

Dave Kreskowiak

GeneralRe: Entity Framework : Save new object and new childs Pin
desanti28-Oct-16 10:14
desanti28-Oct-16 10:14 
GeneralRe: Entity Framework : Save new object and new childs Pin
Dave Kreskowiak28-Oct-16 11:00
mveDave Kreskowiak28-Oct-16 11:00 
GeneralRe: Entity Framework : Save new object and new childs Pin
desanti28-Oct-16 11:47
desanti28-Oct-16 11:47 
GeneralRe: Entity Framework : Save new object and new childs Pin
Dave Kreskowiak28-Oct-16 12:14
mveDave Kreskowiak28-Oct-16 12:14 
QuestionHow to Get a Folder(shell32) icon into a listview in visual basic 6 - Cannot get this right Pin
4SAI26-Oct-16 6:46
4SAI26-Oct-16 6:46 
QuestionUnderstanding Interface From Previous Developer Pin
hilli_micha26-Oct-16 6:44
hilli_micha26-Oct-16 6:44 
AnswerRe: Understanding Interface From Previous Developer Pin
Richard Deeming26-Oct-16 9:22
mveRichard Deeming26-Oct-16 9:22 
AnswerRe: Understanding Interface From Previous Developer Pin
Ralf Meier30-Oct-16 4:47
mveRalf Meier30-Oct-16 4:47 
GeneralRe: Understanding Interface From Previous Developer Pin
hilli_micha31-Oct-16 1:54
hilli_micha31-Oct-16 1:54 
QuestionCheck if record exists Pin
Member 1281653926-Oct-16 2:55
Member 1281653926-Oct-16 2:55 
AnswerRe: Check if record exists Pin
Richard MacCutchan26-Oct-16 3:20
mveRichard MacCutchan26-Oct-16 3:20 
GeneralRe: Check if record exists Pin
Member 1281653926-Oct-16 3:22
Member 1281653926-Oct-16 3:22 
GeneralRe: Check if record exists Pin
Richard MacCutchan26-Oct-16 3:29
mveRichard MacCutchan26-Oct-16 3:29 
QuestionTreview prevent drag/drop according to destination node Pin
desanti24-Oct-16 9:38
desanti24-Oct-16 9:38 
AnswerRe: Treview prevent drag/drop according to destination node Pin
Michael_Davies24-Oct-16 10:02
Michael_Davies24-Oct-16 10:02 
Questionimage prosseing Pin
Member 1281214124-Oct-16 4:43
Member 1281214124-Oct-16 4:43 
AnswerRe: image prosseing Pin
Dave Kreskowiak24-Oct-16 5:34
mveDave Kreskowiak24-Oct-16 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.