I am new to C #, linq and EF4, so please bear with me. I am sure that it is really simple, but not seeing it.
The stored procedure that I am replacing does a SELECT INTO to query a set of data, performs some simple transformations, and then outputs the results to another table. This data set is then returned for local processing in code.
I have a query that outputs my data in an anonymous type and processes all the transformations. But how can I send this data to the result table?
At first, I thought about using an entity type to store my initial results. But I have additional fields that I need for local processing, which will not be saved in the result table.
Thanks to all the EF masters who want to hack this for me!
edit: Here some Morteza-based pseudo code helps, but doesn't seem to move data -
var ctx = new ReportEntities();
var query = from s in ctx.Source
select new
{
s.SourceID,
s.OtherStuff
};
query.ToList().Select(q => new Report()
{
SourceID = q.SourceID,
OtherStuff = q.OtherStuff
});
ctx.SaveChanges();
source
share