Change the generated EntitySet name
Posted: Fri 14 Feb 2020 00:08
I have a database that has two relationships between the same two tables.
In LinqConnect in the "Model Naming" properties, I have everything unchecked for "Class and Method Names" and "Class Properties' Names". When the model is created it creates two associations, with names of "PosTransaction_PosTransItem1" and "PosTransaction_PosTransItem"
The following code is generated :
and
My question : Is it possible to control the naming of the entity set (e.g. PosTransItem_PosTransID and PosTransItem_Fk_PosTransaction_Redeem) ? When the model is created using SQLMetal to create LinqtoSQL, the EntitySet name is just "PosTransItem", so elsewhere in code you would do something like . In this case, it would now be which just looks a bit clumsy.
In LinqConnect in the "Model Naming" properties, I have everything unchecked for "Class and Method Names" and "Class Properties' Names". When the model is created it creates two associations, with names of "PosTransaction_PosTransItem1" and "PosTransaction_PosTransItem"
The following code is generated :
Code: Select all
[Devart.Data.Linq.Mapping.Association(Name="PosTransaction_PosTransItem", Storage="_PosTransItem_Fk_PosTransaction_Redeem", ThisKey="PosTransID", OtherKey="Fk_PosTransaction_Redeem", DeleteRule="NO ACTION")]
public EntitySet<PosTransItem> PosTransItem_Fk_PosTransaction_Redeem
{
get
{
return this._PosTransItem_Fk_PosTransaction_Redeem;
}
set
{
this._PosTransItem_Fk_PosTransaction_Redeem.Assign(value);
}
}
Code: Select all
[Devart.Data.Linq.Mapping.Association(Name="PosTransaction_PosTransItem1", Storage="_PosTransItem_PosTransID", ThisKey="PosTransID", OtherKey="PosTransID", DeleteRule="NO ACTION")]
public EntitySet<PosTransItem> PosTransItem_PosTransID
{
get
{
return this._PosTransItem_PosTransID;
}
set
{
this._PosTransItem_PosTransID.Assign(value);
}
}
Code: Select all
posTrans.PosTransItem.Where(p=> p......)
Code: Select all
posTrans.PosTransItem_PosTransID.Where(p=> p......)