Click here to Skip to main content
15,792,539 members

Comments by glitteringsound (Top 4 by date)

glitteringsound 24-Dec-16 16:15pm View    
Hwo would SQL server will knwo what child belongs to which parent?
and how many children are there for specific parent in this case, If I save parent and children seperately. For example Consignment1 has 4 ConsignmentLines, 3 ConsignmentAddresses, while other consignment has 2 Consignmentlines and 5 ConsignmentAddresses
glitteringsound 24-Dec-16 14:54pm View    
Previously I used entity framework for saving 100K rocords in database where each recod further contains child records.

my object hierarchy is :

public class Consignment



List<consignmentaddress> addresses {get; set;}

List<consignmentline> lines { get; set; }


I could expect Consignments Count = 100K and each Consignment could contain 2 ConsignmentLines and on average 3 Consignment Addresses.

So this all makes roughly = 100K + 200K + 300K = 600K records .

For inserting all these 600K records, I used entity framework and this was damn slow. Then I devided the file in chunks and parse 1000 records and inserted using EF by recreating context each time. This was very improved . But still that does not full fill my requirement ( as in future i could expect 500K root level records and each further could contain 3-4 child record in each list. That could make 1200K records in database).

Now I need fast and efficient solution.

That's why I want to send the whole hierarchy at once, so that i can iterate that collection inside SQL and insert the parent child records. As this would be close to metal , it would be 10 times faster than entity framework.
But at the moment, I am iterating this List<consignment> collection from .NET C# in loop and for each consignment, along with it's children ( i.e List<consignmentaddress>, List<consignmentline> ), I am calling stored procedure and sending these 3 as TVP ( 1 for Consignment, 2nd for List<consignmentaddress>, 3rd for List<consignmentline> ). This procedure is also very slow. Because, for 100K root records, 100K stored procedure calls are going.

Now I need a solution, which takes the whole hierarchy or at least some chunk and push all the data at once by keeping whole parent child relationship intact.
glitteringsound 10-May-11 3:06am View    
Ok I googled. This will create directories on my disk here. What it has to do with my problem? How creating the directory will actually solve my problem?
glitteringsound 10-May-11 3:02am View    
What do you mean by directory class? How can it be implemented?