My .NET entity looks like this:
public class Customer
{
public long Id { get; set; }
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public DateTime BornOn { get; set; }
public string RegisteredAddress { get; set; }
public string ResidentalAddress { get; set; }
}
To create a client-side version in Breeze, I use the following code:
store.addEntityType({
shortName: 'Customer',
namespace: 'ClientSide.App',
dataProperties: {
id: { dataType: types.long, isNullable: false, isPartOfKey: true },
firstName: { dataType: types.string },
middleName: { dataType: types.string },
lastName: { dataType: types.string },
bornOn: { dataType: types.datetime },
registeredAddress: { dataType: types.string },
residentalAddress: { dataType: types.string },
lastNameWithInitials: { dataType: types.string },
phone: { dataType: types.string },
mobilePhone: { dataType: types.string },
email: { dataType: types.string }
}
});
Now, I have added a new server-side property:
public Passport Passport { get; set; }
defined as:
public class Passport
{
public string Series { get; set; }
public string Number { get; set; }
public DateTime IssuedOn { get; set; }
public string IssueAuthority { get; set; }
}
I am unsure how to add it to Breeze?
Update:
Is it possible to achieve this without using a getter
property like this:
public string Phone
{
get
{
var contact = Contacts.FirstOrDefault(c => c.Type == ContactType.Phone);
return contact != null ? contact.Value : "";
}
}
Are there any alternative ways to do this?