-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
Todd Thomson edited this page Aug 13, 2018
·
9 revisions
Your application must first create a custom data context by declaring a class that is derived from DataContext.
/// <summary>
/// The Todo app data context.
/// </summary>
/// <remarks>
/// Custom data contexts derive from <see cref="DataContext"/>.
/// </remarks>
public class TodoDataContext: DataContext
{
}
Next, define and add your EntitySets to you DataContext.
public class TodoDataContext: DataContext
{
private static TodoDataContext _dataContext;
/// <summary>
/// Gets or sets the Todo items.
/// </summary>
/// <remarks>
/// Entity sets support the <see cref="IQueryable"/> interface.
/// </remarks>
public EntitySet<TodoItem> TodoItems { get; set; }
public TodoDataContext( DataContextOptions options ) : base( options )
{
// Add your entity sets to the context in the data context constructor.
TodoItems = new EntitySet<TodoItem>( this );
}
}