Auto set field MaxLength facet on creation

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Posts: 10
Joined: Mon 18 Jan 2010 10:48
Location: Devon, UK

Auto set field MaxLength facet on creation

Post by stephen.Cognito » Mon 25 Jan 2010 14:48


Is it possible to have a setting to auto set the MaxLength facet of the table field (namely string type) on creation of the entity when creation is from an existing database. I see the option is there to set the property field by field for each table manually but on a large schema that is constantly evolving this is very time consuming.
I use the following code to get this value from the entity model...

ObjectStateEntry os = Entity.ObjectStateManager.GetObjectStateEntry(Table);
object value = os.EntitySet.ElementType.Members["Description"].TypeUsage.Facets["MaxLength"].Value;

I am looking to use this functionality for a validation class that will auto set the max edit length of an edit control from the entity string field thats assigned to it.

Thank you

Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 26 Jan 2010 14:33

We have already implemented the MaxLength facet value setting.
Are the MaxLength facets set correctly
for both storage and conceptual properties of the varchar field? Please point out where the error is.

Post Reply