views:

54

answers:

1

i dislike below methods. Because more fields (suchas 150 fields) it is not good method. There is any SetValue method to add datato sql linqtosql for submitchanges?


 MyClass c = new MyClass ();
              c.FirstField = "bvnvb";
              c.......
              c...
              c...

             // Too many rows there is...
              engCtx.MyClass.InsertOnSubmit(c);
              engCtx.SubmitChanges();

How can i do with a loop method via using linq?

it is simple request why don't understand it is clear. i don't want to make it above is there any method like below?


foreach(...........)
engCtx.MyClass.Add(item);

+1  A: 

It's not clear what you want.

The LINQ part of this is only two lines.

The "creating an object the way you want it part" is longer, but it's your object, it's under your control. Add a ctor which takes a number of parameters. Add SetXXXX() methods which set a number of properties at once. (Use partial classes if the main part of tha main is generated)

James Curran
i changed it...........
Phsika