If you want to specify other columns that should use the table as in this previous example
So, in your case, you can do something like:
Db.First<Model>("SELECT Column1, Column2 FROM AnyTableOrView");
You can also create a partial model that looks at your table by decorating it with the [Alias] attribute, for example:
[Alias("AnyTableOrView")] public class Model { public int Id { get; set; } public string Column1 { get; set; } public string Column2 { get; set; } }
Then you can do something like:
Db.First<Model>(q => q.Id == someId);
And it will only SELECT + fill in the fields from the partial model.
mythz
source share