tags:

views:

217

answers:

2

Is it possible to add a custom property in the designer and have it not bound to a column? I fiddled with the settings a bit settled on making a partial class with the property. Is there a way to show this field in the ORM designer?

+1  A: 

In the Designer, right click on the Object Properties header and Add => Property.

hunter
This results in a SqlException: "Invalid column name {MyColumnName}"
blu
whoops, forgot this: Add this attribute to the Property in the designer.cs file.[Column(IsDbGenerated=false)]
hunter
You should probably just make this Propertypublic string PropertyName { get; set; }you'll have to do this each time you rebuild your DBML, but you'll get the ORM Designer showing the Property like you wanted.
hunter
yeah I realized the attribute will be overwritten. Looks like I will just use the partial class.
blu
+1  A: 

The LINQ-to-SQL designer is maintaining the mapping. Unmapped properties need to go in a separate partial class.

Marc Gravell