-
-
Notifications
You must be signed in to change notification settings - Fork 0
Sample Model
The virtual decoration will have the following effects based on what type of property it is.
If the property is a value property, the virtual decoration will enable the proxy to be flagged dirty when ever this value changes from the original value.
if the property is a navigation property, the virtual decoration will enable the associated foreign keys to be set according to the key data of the navigation property value. If the foreign key value is greater than zero the proxy will load the property from the db/cache if the property is in a null state.
if the property is a collection, the virtual decoration will enable the proxy to retrieve all records from the respective table for this record from the db/cache if the collection is empty or null.
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TheDataLayer.Models
{
public class Person
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
public virtual string FirstName { get; set; }
public virtual string MiddleInitial { get; set; }
public virtual string FamilyName { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public string FullName { get; set; }
public virtual ISubSonicCollection<Renter> Renters { get; set; }
public virtual ISubSonicCollection<Unit> Units { get; set; }
}
}