Example #1
0
        /// <summary>
        /// The constructor of a basic dao class
        /// Here we create the table config and all the field configs needed for the dao to functional properly
        /// </summary>
        /// <param name="context">A DatabaseContext object containing the connection string</param>
        protected Dao(DatabaseContext context)
        {
            DaoManager = DaoManager.Get(context);
            Database   = Database.Get(context);
            EntityType = typeof(T);

            TableConfig = DatabaseUtil.CreateTableConfig <T>(EntityType);

            CreateFieldConfigs();
        }
Example #2
0
        /// <summary>
        /// Singleton pattern to get the DaoManger class
        /// </summary>
        /// <param name="context">A DatabaseContext object containing the connection string</param>
        /// <returns>An instance of the DaoManger class</returns>
        public static DaoManager Get(DatabaseContext context)
        {
            if (_instance == null)
            {
                _instance = new DaoManager();
                _context  = context;

                _instance.RegisterDaos();
            }

            return(_instance);
        }