Beispiel #1
0
        /// <summary>
        /// Adds a new store named TEntity.Name and adds Key and Indexes based on IndexedDbKey and IndexedDbIndex Attributes
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public static IndexedDbStore AddStore <TEntity>(this IndexedDbDatabaseModel model)
        {
            model.Stores ??= new List <IndexedDbStore>();

            var store = new IndexedDbStore {
                Name = typeof(TEntity).Name
            };

            store.SetupFrom <TEntity>();

            model.Stores.Add(store);

            return(store);
        }
        /// <summary>
        /// Adds a new store and adds Key and Indexes based on IndexedDbKey and IndexedDbIndex Attributes
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="model"></param>
        /// <param name="storeName"></param>
        /// <returns></returns>
        public static IndexedDbStore AddStore <TEntity>(this IndexedDbDatabaseModel model, string storeName)
        {
            if (model.Stores == null)
            {
                model.Stores = new List <IndexedDbStore>();
            }

            var store = new IndexedDbStore();

            store.Name = storeName;

            store.SetupFrom <TEntity>();

            model.Stores.Add(store);

            return(store);
        }