I have a part of a model like this:
public class RepeatDetails
{
public enum Types { Daily = 0, Weekly = 1, Monthly = 2, Yearly = 3 }
public Types Type { get; set; }
public DailyDetails Daily { get; set; }
public class DailyDetails
{
public enum Types { EveryDay = 0, EveryWorkingDay = 1 }
public Types Type { get; set; }
// ...
}
// ...
}
When I try to add-migration, I get an error:
The type 'MyProject.RepeatDetails+DailyDetails+Types' and the type 'MyProject.RepeatDetails+Types' both have the same simple name of 'Types' and so cannot be used in the same model. All types in a given model must have unique simple names. Use 'NotMappedAttribute' or call Ignore in the Code First fluent API to explicitly exclude a property or type from the model.
I know that's EF restriction, you can't use same simple types. What I can do now is to rename these options with RepeatDetailsTypes, DailyDetailsTypes, etc. But I don't want to modify my model only because of restrictions of third-party library/libraries (moreover, this restriction could be removed in the next versions of EF). I want to keep my code clean and easier for other developers. If I run this way, I can end up with a huge mess inside of my code.
So I wonder, is there any workaround to keep the model clean and use it with EF? Maybe some kind of attributes or whatever? Any examples would be highly appreciated.