I have this model
public class model
{
public string at1{set; get;}
public string at2{set; get;}
public string at2{set; get;}
public string at2{set; get;}
public string at2{set; get;}
};
I make an instance of model like:
List<model> md= new List<model>();
then I write a query like this from a table with same names as model is
md = db.SomeTable.Where(a => a.at1 == '1').Select (row => new model()).ToList()
What I am seeking is put whole of any row in SomeTable into model's format. Obviously my code isn't working and return null data and if change it like this, it works
md = db.SomeTable.Where(a => a.at1 == '1').Select (row => new model
{
at1=a.at1,
at2=a.at2,
at3=a.at3,
at4=a.at4,
at5=a.at5,
).ToList()
I dont want to put every attribute name in my query, Is there any substitute?
Note: I dont want to use Model of Database I mean (SomeTable's Model) I want to receive result of query in another model. (Because of join, include, etc)