c# - LINQ to DataSet Dataclass assignment question -


Text after "

I am working on a Silverlight project while accessing a database dataset using LINQ, and then through Silverlight Send data to ASMX Web Service

I defined my dataset using the Server Explorer tool (I am interested in dragging and dropping all the different tables) to use the dataset server and database without any problem Enabled.

The code for one of my web methods is given below:

  Public listing & lt; ClassSpecification & gt; GetSpecifications () {DataSet2TableAdapters.SpecificationTableAdapter Sta = New DataSet2TableAdapters.SpecificationTableAdapter (); . Return to Sta.GetData () (AsEnumerable with New ClassSpecification Selection) (Specification = Spec.Field & LT; String & gt; ("Specification"), SpecificationType = Spec.Field & LT; String & gt; "SpecificationType"), StatusChange = Spec.Field & LT; Date Time & gt; ("StatusChange"), Tip = Spec.Field & LT; Integer> ("Tip")} ToList & Lt; ClassSpecification & gt; (); }  

I have created a "class classification" data square which contains my data and has all the table field properties in it as I

My question is this Is there a faster way to perform assignments compared to what is shown here? In fact, there are about 10 more fields, and I imagine that since my dataset knows the definition of my table, I would have a faster way of assigning more assignment than going into field area. I just tried to choose "New Class Classifications (). ToList

Any help would be greatly appreciated.

First, I will suggest testing of various possibilities using LINQPad, which is free and horrible.

I can not quite miss what you can do with table adapter , But you should be able to use the dataset data you want to receive, such as on For the

  string imagery = myDataSet.MyTable.Rows [0] // or FindBy ... or you are still selecting a line .Specification;  

Then you may be able to do this

  foreach (the top row in myDataSet.MyTable.Rows) {string fantasy = row.Specification ...}  
return (select the new class display () explanation from the line in myDataSet {Specification = Row} Explanation, Specification Type = Row. Explanation Type, Change Status = Pt Ti Change Ktats, Spacey = line. SPE,}). Telst & lieutenant; Understanding classifier & gt; ();

Or even

  back to myDataSet.Specification.Cast < ClassSpecification & gt; ()  

Not sure if the last one will work, but you can see that there are many ways to get what you want. Apart from this, the line has been typed strongly in my tests, so you should not have to create a new class to insert data - you should be able to use the existing "Specification" class (in fact, me Believe it is.)


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -