Column Properties

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Ekki
Posts: 34
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany
Contact:

Column Properties

Post by Ekki » Thu 06 Mar 2014 17:05

Hi,

is it possible to read this annotation information

Code: Select all

[Column(Name = @"""Name""", Storage = "_Name", CanBeNull = false, DbType = "varchar(45) NOT NULL", IsPrimaryKey = true)]
from C#? I would like to consider the size of the DB string (here: 45) in order to do some smart handling rather than getting an exception.

Even if there's a way to access the information, what's the canonical way to do it?

Thx ia,

Ekki

P.S. Have been quiet for a pretty long time. This is… because… YOUR STUFF JUST WORKS! Does what I expect it should do… like it, enjoy it, just GREAT!!

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Column Properties

Post by MariiaI » Fri 07 Mar 2014 11:14

You can set the validation rules for entity properties. To do it please open your model, in the Model Explorer select the Data Annotations Metadata template in the Templates node (the Model Explorer can be opened by selecting Model Explorer from the Entity Developer submenu of the Tools menu). Set its Validation property to True. If there is no special need to use this template, you can set the Validation Framework property to Data Annotations for the LinqConnect template.
After you have made these changes, select a particular class property on a diagram (or in Model Explorer) and initialize the needed attributes from the Validation section in the Properties window. Save the model to regenerate the code (the code will be regenerated with all necessary attributes).

Please refer to the corresponding topic in the Entity Developer documentation: Basic Workflows-> Code generation-> Entity Property Validation.

If this information doesn't help, please specify the problems you are encountering in more details.

Post Reply