Click here to Skip to main content
15,909,030 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: HashSet(Of T) - how can I get elements by position number ? Pin
dilkonika16-Apr-15 7:32
dilkonika16-Apr-15 7:32 
GeneralRe: HashSet(Of T) - how can I get elements by position number ? Pin
Sascha Lefèvre16-Apr-15 8:16
professionalSascha Lefèvre16-Apr-15 8:16 
GeneralRe: HashSet(Of T) - how can I get elements by position number ? Pin
dilkonika16-Apr-15 8:26
dilkonika16-Apr-15 8:26 
GeneralRe: HashSet(Of T) - how can I get elements by position number ? Pin
Sascha Lefèvre16-Apr-15 8:36
professionalSascha Lefèvre16-Apr-15 8:36 
Questionwhy this code doesn't work ? Pin
dilkonika13-Apr-15 6:20
dilkonika13-Apr-15 6:20 
AnswerRe: why this code doesn't work ? Pin
Sascha Lefèvre13-Apr-15 13:56
professionalSascha Lefèvre13-Apr-15 13:56 
GeneralRe: why this code doesn't work ? Pin
dilkonika13-Apr-15 14:11
dilkonika13-Apr-15 14:11 
GeneralRe: why this code doesn't work ? Pin
Sascha Lefèvre13-Apr-15 15:37
professionalSascha Lefèvre13-Apr-15 15:37 
Correct, the code you have there is expecting an EdmScalarPropertyAttribute on each field or property that should be copied (with the exception of EntityCollections). You didn't decorate the properties of your class with this attribute, so the SetValue(..)-line was skipped.

Note: I'm not familiar with EF. My following advice should make your CloneEntity-code work (or at least "almost working") but someone who knows about EF might have more to say about it. In particular, I have no idea where the id of your classes gets initialized; if you have to deal with that yourself or if it's somehow magically done for you.
  • Move the SetValue(..)-line back to where it was.
  • Put an EdmScalarPropertyAttribute on the name-property of the Myobject-class and on all properties of the Child_list-class (except id and ParentID) like so:
    VB
    <EdmScalarProperty()>
    Public property name as string
  • In CloneEntityHelper(..), change the string "EntityCollection`1" to "ICollection`1".
  • If you want to have children of children copied (to an arbitrary depth), set the Children-property of your IncludeEntity-instance to the same IncludeEntity-instance.
  • If you have to initialize id yourself, you will have to set it for Myobjects, Child_lists and potentially further nested objects, after the call to CloneEntity(..).
  • Because of the self-referencing through ParentID you will have to set ParentID for all children (and potentially children of children) to their respective parent's id after the call to CloneEntity(..) (in any case).
That should be it I think..
GeneralRe: why this code doesn't work ? Pin
Sascha Lefèvre14-Apr-15 12:56
professionalSascha Lefèvre14-Apr-15 12:56 
QuestionEntity Framework : Clone an object and only its childs Pin
dilkonika11-Apr-15 17:47
dilkonika11-Apr-15 17:47 
AnswerRe: Entity Framework : Clone an object and only its childs Pin
Sascha Lefèvre11-Apr-15 21:02
professionalSascha Lefèvre11-Apr-15 21:02 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
dilkonika12-Apr-15 11:32
dilkonika12-Apr-15 11:32 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
Sascha Lefèvre12-Apr-15 11:40
professionalSascha Lefèvre12-Apr-15 11:40 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
dilkonika12-Apr-15 11:38
dilkonika12-Apr-15 11:38 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
Sascha Lefèvre12-Apr-15 12:09
professionalSascha Lefèvre12-Apr-15 12:09 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
dilkonika12-Apr-15 13:26
dilkonika12-Apr-15 13:26 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
Sascha Lefèvre12-Apr-15 14:39
professionalSascha Lefèvre12-Apr-15 14:39 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
dilkonika12-Apr-15 15:05
dilkonika12-Apr-15 15:05 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
Sascha Lefèvre12-Apr-15 23:18
professionalSascha Lefèvre12-Apr-15 23:18 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
dilkonika13-Apr-15 5:04
dilkonika13-Apr-15 5:04 
GeneralRe: Entity Framework : Clone an object and only its childs Pin
Sascha Lefèvre13-Apr-15 5:30
professionalSascha Lefèvre13-Apr-15 5:30 
QuestionEntity Framework : Why this extension is not usable ? Pin
dilkonika10-Apr-15 18:25
dilkonika10-Apr-15 18:25 
AnswerRe: Entity Framework : Why this extension is not usable ? Pin
Dave Kreskowiak10-Apr-15 19:56
mveDave Kreskowiak10-Apr-15 19:56 
GeneralRe: Entity Framework : Why this extension is not usable ? Pin
dilkonika10-Apr-15 20:03
dilkonika10-Apr-15 20:03 
GeneralRe: Entity Framework : Why this extension is not usable ? Pin
Dave Kreskowiak10-Apr-15 20:34
mveDave Kreskowiak10-Apr-15 20: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.