Skip to content
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

Nested complex type case not handled properly #60

Open
kavhad opened this issue Oct 13, 2017 · 4 comments
Open

Nested complex type case not handled properly #60

kavhad opened this issue Oct 13, 2017 · 4 comments

Comments

@kavhad
Copy link

kavhad commented Oct 13, 2017

In a case where a complex type is a subproperty within a complex type, then running EnumToLookup.GenerateMigrationSql(...) seems to ignore the enum property.
The following code describes the case

public class Entity {
   public int Id {get;set;}
   public Foo MyFoo {get;set;}
}

[ComplexType]
public class Foo {
   public string Text {get;set;}
   public Bar MyBar {get;set;}
}

[ComplexType]
public class Bar {
   public string Text {get; get;}
   public BarType Type {get;set;}
}

public enum BarType {
   SMALL,
   MEDIUM, 
   LARGE
}
@kavhad
Copy link
Author

kavhad commented Oct 13, 2017

I noticed these comment lines in the file MetaDatahandler.cs:

// Note that complex types can't be nested (ref http://stackoverflow.com/a/20332503/10245 )
// so it's safe to not recurse even though the data model suggests you should have to.

So this is by design, but there's no such limitation at least not in EF version 6.1.3, nested complex types are valid and works like expected. The limitation is with relational properties within complex types.

@timabell
Copy link
Owner

Would you be able to write a unit test & fix? Then do a PR?
Or if not I could do it on a consultancy basis.
Is it causing you a problem with your code/business?

@kavhad
Copy link
Author

kavhad commented Oct 13, 2017

I'll try to do a fix for it myself and do a PR.

Thanks for everything you've put into it already.

@timabell
Copy link
Owner

Cool. You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants