It is impossible to implement this scenario directly. In fact, you are able to access the ShopName property via the navigation property "ShopInfo".
If this option does not suit you, we recommend you one of the following options:
1) Write an SQL query with JOIN, which will select the necessary rows from the Operator table and the ShopName from the ShopInfo table:
- open Model Explorer -> YourModel.Store;
- select Add->New Defining Query from the shortcut menu of the Tables/Views item;
- write the SQL query in the General tab of the opened window;
- after that you will get the resulting columns set (Columns tab).
Please refer to the corresponding topic in the Entity Developer documentation: ORM Support -> Entity Framework -> Concepts -> Storage Metadata Schema -> Creating Tables -> section "How to Create Table from the SELECT Statement".
2) Write a Entity SQL query with JOIN, which will select the necessary Operator entities and the ShopName from the ShopInfo entity:
- select "Mapping Details" from the shortcut menu of the Operator entity class;
- write the eSQL query in the Query View tab of the opened window.
Please refer to the corresponding topic in the Entity Developer documentation: ORM Support -> Entity Framework -> Concepts -> Working with Classes -> Entity Mapping -> section "Creating a QueryView Mapping".
3) If this scenario can be realized at runtime only, then you could create a partial class for the Operator entity class and access the ShopName column in the following way:
Code: Select all
public partial class Operator
{
public string ShopName
{
get
{
return ShopInfo.ShopName;
}
}
}
....
var query = (from c in context.Operator select c).First().ShopName;
Please tell us if this information helps.