Custom Types (Already Exists?)

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
PixelHunter
Posts: 17
Joined: Thu 29 Jun 2017 11:07

Custom Types (Already Exists?)

Post by PixelHunter » Tue 24 Sep 2019 08:58

Hi, I am using Entity Developer Version 6.5.823!

I have made a complex EF Core Model which I have to edit very often, it would be cool If I can create a custom types (string, int and so) with certain validation properties for example:

MyTypeEmail
Value: String
Validate Max Length: 128
Validate Format: Email

MyTypeUrl
Value: String
Validate Max Length: 255

In my model I have many entities which contain Emails (string type) the Idea is to map all this Email Properties with the MyTypeEmail so that If I need to change the Validate Max Length in the future I modify the properties of MyTypeEmail only and not each of the Email properties scattered throughout the model.

And also, next time I create a property that is an Email I map it to the corresponding MyTypeEmail.

Maybe this option already exists, but I have search in the Documentation and the forums and I can´t find any result.

Thanks in Advance!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Custom Types (Already Exists?)

Post by Shalex » Mon 30 Sep 2019 16:52

EntityComplexType in EF Core Model includes the Is External property.
Its description: "Indicates that the complex type is a reference to an external type. If the value is set to 'True', code generation is disabled for this complex type."

So, define a custom type in your code with all required attributes, create a complex type with the same name and Is External=True in EF Core Model, use it for setting the Type in your class properties.

Post Reply