Click here to Skip to main content
15,907,392 members
Home / Discussions / Visual Basic
   

Visual Basic

 
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 
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 
Hello !
I have see several methods around for deep cloning an entity framework object. All these methods use serialization. But sometimes these methods are not creating what I want.
For example I try to use the Json.net (http://www.newtonsoft.com/json[^])

to serialize and after to deserialize a object.

And after I use this code to clone :
VB
<Extension> _
    Public Function CloneJson(Of T)(source As T) As T
        If [Object].ReferenceEquals(source, Nothing) Then
            Return Nothing
        End If
      Return JsonConvert.DeserializeObject(Of T)(JsonConvert.SerializeObject(source))
     End Function

But look how an object is cloned on my case :
( I want to clone a student and its Results )
Student ID......... Name........Age
       1...........George........21

Course_ID..........Description     Type
   1.....................Math........1

Result_ID..........Course_ID......Student_ID..... Point
  1......................1...............1..........30

And after the cloning :
Student ID......... Name........Age
      1...........George........21
       2...........George........21

Course_ID..........Description     Type
 1.....................Math...........1
 2.....................Math...........1

Result_ID..........Course_ID......Student_ID..... Point
  1......................1...............1..........30
  2......................2...............2..........30

So now are 2 courses with name "Math". but I don't want to clone the courses.

How to resolve this problem ?
Thank you !
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 
GeneralRe: Entity Framework : Why this extension is not usable ? Pin
dilkonika11-Apr-15 5:33
dilkonika11-Apr-15 5:33 
GeneralRe: Entity Framework : Why this extension is not usable ? Pin
Dave Kreskowiak11-Apr-15 7:00
mveDave Kreskowiak11-Apr-15 7:00 

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.