Setting Entity DisplayMember to Calculated/Read-only Member

Mar 12, 2009 at 2:46 PM
Suppose I have an Entity called Customer with members called FirstName and LastName.  I want to add a member called FullName as such.

public string FullName { get{ return string.Format("{0}, {1}", LastName, FirstName); }}

and, I want to make FullName the DisplayMember on the Customer entity.  Notice that FullName is a read-only field that is not stored in the database.

Any suggestions on how to accomplish this using sculpture? 
Mar 14, 2009 at 12:27 AM
I've tried out your question myself as I'm also very interested in Sculpture.

In order to add calculated field to your entity you should simply add additional code file where implement anything like this:

namespace

 

LinqBLL.Entities
{
public partial class Entity1
{
public string PartialIdPlusName
{
get { return this.Id + " " + this.Name; }
}
}
}

Where Entity1 is one of your entities in your sculpture model. Then you need simply to add appropriate column to Entity1List.cs form designer  file in your UI project and set its DataPropertyName equal to PartialIdPlusName.

So, two steps:
1. Add partial property
2. Add column to List or Add Form designer

That's all I guess