Quantcast
Channel: EntityFramework Reverse POCO Code First Generator
Viewing all articles
Browse latest Browse all 1642

Closed Feature: Make use of db comments to aid with data annotations [56]

$
0
0
As emailed to me by Fatih Yücel ŞEN <fatihyucelsen@hotmail.com>

When reading the database schema, also read the column __comments__ for each field.
This could be in the format of:
```
field=value;field=value;...
```

For example of column __comments__:
* name=Currency code;req=3 digit currency code is required;max=3
* email=true
* password=true

Gives:
* [Display(Name = "Currency code")]
[Required(ErrorMessage = "3 digit currency code is required")]
[StringLength(3, ErrorMessage = "Must not exceed 3 characters")]

* [DataType(DataType.EmailAddress)]
[RegularExpression(@\"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?

* [DataType(DataType.Password)]

Attachment is based on v2.4.1 code

Viewing all articles
Browse latest Browse all 1642

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>