Demo of ADO.NET POCO with SQLite database

This demonstration shows how to prepare for and how to implement model-first ADO.NET POCO objects with a SQLite backing store.

C# (46.5 KB)
 
 
 
 
 
5 Star
(1)
3,378 times
Add to favorites
9/12/2011
E-mail Twitter del.icio.us Digg Facebook
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated from a template.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Data.Objects;
using System.Data.EntityClient;

namespace POCOWithSQLiteDemo.Model
{
    public partial class DataModelContainer : ObjectContext
    {
        public const string ConnectionString = "name=DataModelContainer";
        public const string ContainerName = "DataModelContainer";
    
        #region Constructors
    
        public DataModelContainer()
            : base(ConnectionString, ContainerName)
        {
            this.ContextOptions.LazyLoadingEnabled = true;
        }
    
        public DataModelContainer(string connectionString)
            : base(connectionString, ContainerName)
        {
            this.ContextOptions.LazyLoadingEnabled = true;
        }
    
        public DataModelContainer(EntityConnection connection)
            : base(connection, ContainerName)
        {
            this.ContextOptions.LazyLoadingEnabled = true;
        }
    
        #endregion
    
        #region ObjectSet Properties
    
        public ObjectSet<Blog> Blogs
        {
            get { return _blogs  ?? (_blogs = CreateObjectSet<Blog>("Blogs")); }
        }
        private ObjectSet<Blog> _blogs;
    
        public ObjectSet<Post> Posts
        {
            get { return _posts  ?? (_posts = CreateObjectSet<Post>("Posts")); }
        }
        private ObjectSet<Post> _posts;

        #endregion
    }
}