This question is locked. New answers and comments are not allowed.
I like to know if it is possible to use interfaces to define your models in the OpenAccessContext.
So now we have the following code.
Is it possible to change it into:
So that the IQueryable also use the interfaces of the models.
So now we have the following code.
public
partial
class
DataContext : OpenAccessContext
{
static
MetadataContainer metadataContainer =
new
DataMetadataSource().GetModel();
static
BackendConfiguration backendConfiguration =
new
BackendConfiguration()
{
Backend =
"mssql"
};
private
const
string
DbConnection =
"connectionID"
;
public
DataContext()
:
base
( DbConnection, backendConfiguration, metadataContainer )
{
}
public
IQueryable<Product> Products
{
get
{
return
this
.GetAll<Product>();
}
}
public
IQueryable<Category> Categories
{
get
{
return
this
.GetAll<Category>();
}
}
// Rest of the code
}
Is it possible to change it into:
public
partial
class
DataContext : OpenAccessContext
{
static
MetadataContainer metadataContainer =
new
DataMetadataSource().GetModel();
static
BackendConfiguration backendConfiguration =
new
BackendConfiguration()
{
Backend =
"mssql"
};
private
const
string
DbConnection =
"connectionID"
;
public
DataContext()
:
base
( DbConnection, backendConfiguration, metadataContainer )
{
}
public
IQueryable<IProduct> Products
{
get
{
return
this
.GetAll<IProduct>();
}
}
public
IQueryable<ICategory> Categories
{
get
{
return
this
.GetAll<ICategory>();
}
}
// Rest of the code
}
So that the IQueryable also use the interfaces of the models.