Mediator
Mediator

Reputation: 15378

How add property to EF4

How add new property to WorkSpace which will show the name room?

enter image description here

Upvotes: 0

Views: 59

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364279

This property cannot be defined in entity designer unless it is also defined in the database as column of WorkPanel table. Create partial class to generated entity and add custom property:

public partial class WorkPanel
{
    public string Name
    {
        get
        {
            return (Table != null && Table.Room != null) ? Table.Room.Name : null;
        }
    }
}

To use this property you must always load Table and Room entity with WorkPanel (either by eager or lazy loading).

Upvotes: 1

Related Questions