Customization & Refactoring
Please watch this video for an in-depth overview of Customization & Refactoring.
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Unlike standard LINQ to SQL, PLINQO supports customizing and refactoring your DBML.
...
Metadata Customization/Syncing
The System.ComponentModel.DataAnnotations assembly introduced in .NET 3.5 SP1 provides another opportunity for PLINQO to make life easier. PLINQO generates and maintains a metadata class inside each entity. This metadata class allows you to easily add extra knowledge about your domain objects and their properties. Each time PLINQO is re-generated, DBML and database changes are synced while preserving any custom changes using a new feature in CodeSmith called the insert class merge strategy. The process of maintaining metadata on each entity in the system now can be as simple as regenerating your metadata classes.
Here is a picture of a MetaData class that sits inside a User class.
Code Block | ||
---|---|---|
| ||
[CodeSmith.Data.Audit.Audit]
private class Metadata
{
// Only Attributes in the class will be preserved.
public int Id { get; set; }
[Required]
public string UserName { get; set; }
[Required]
[DataType(System.ComponentModel.DataAnnotations.DataType.Password)]
public string Password { get; set; }
[DataType(System.ComponentModel.DataAnnotations.DataType.EmailAddress)]
public string EmailAddress { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public System.Data.Linq.Binary Avatar { get; set; }
[Now(EntityState.New)]
[CodeSmith.Data.Audit.NotAudited]
public System.DateTime CreatedDate { get; set; }
[Now(EntityState.Dirty)]
[CodeSmith.Data.Audit.NotAudited]
public System.DateTime ModifiedDate { get; set; }
public System.Data.Linq.Binary RowVersion { get; set; }
public EntitySet AssignedTaskList { get; set; }
public EntitySet CreatedTaskList { get; set; }
public EntitySet UserRoleList { get; set; }
} |
Having this pre-configured sure makes it obvious where to go when extra knowledge is needed about the model. ASP.NET Dynamic Data attributes such as what control should display the data, data types, how to validate fields and actions taken on properties are just a few of the attributes available for use within the metadata class.