-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to configure a Property in a parent class for a Property of a nested Owned class directly? #1339
Comments
Did you try:
|
Yes i did, result was |
I think you can do like this: If you can change your modela) Add a new property as follows public class Main
{
public Properties Properties {get;set;}
+ public string Ware {
+ get => Properties.Property1;
+ set => Properties.Property1 = value;
+ }
...
} b) Ignore the 'Properties' If you cannot change your model:a) Ignore the 'Properties', same as above var builder = ....
EdmModel model = builder.GetEdmModel() as EdmModel;
var mainType = model.SchemaElements.OfType<EdmEntityType>().First(c => c.Name == "Main") as EdmEntityType;
var wareProperty = mainType.AddStructuralProperty("Ware", EdmCoreMode.Instance.GetString(false));
PropertyInfo propert1Info = typeof(Properties).GetProperty("Property1");
model.SetAnnotationValue(wareProperty, new ClrPropertyInfoAnnotation(property1Info)); Some function names maybe not correct. Please let me know if it cannot work. |
Thanks. I need second variant, because i dont know property name in compile time.
|
can you share your repro? |
@xuzhg , example - https://github.com/ptrushin/odata-text
|
I have
And I want to configure Property1 as Main class property with name Ware.
When i try
i get an exception
'MemberExpressions must be bound to the LambdaExpression parameter.'
How can i do this?
The text was updated successfully, but these errors were encountered: