Decide the entity type of entity framework query dinamically
Let's say I have a DbContext sub class that looks like
public partial class DBEntities : DbContext
{ ...//More to come }
and in this class I have 2 DataSets
public DbSet<Config> Config { get; set; }
public DbSet<Parameters> Parameters { get; set; }
that look like:
public partial class Config
{
public string Name { get; set; }
public string Value { get; set; }
public string Override { get; set; }
public string Description { get; set; }
}
AND
public partial class Parameters
{
public string Id { get; set; }
public System.DateTime UpdateTime { get; set; }
public float AzValue_rad { get; set; }
public float E_rad { get; set; }
public float N_rad { get; set; }
}
Now let's say I want to have a configuration xml that will encode saved
queries. How can I do that and keep my type strength?
e.g. How can I encode the query
using (var db = new DBEntities())
{
var query = from floatTag in db.Config
select floatTag;
where floatTag.Name = "SOME_VALUE"
}
No comments:
Post a Comment