Esempio n. 1
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        /// <param name="modelBuilder"><see cref="ModelBuilder"/></param>
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            //EFCore will cached model info.This method only called once
            var storeModelExpression = new EFModelExpressionProvider().GetExpression();

            storeModelExpression.Interpret(StoreConfig.Instance.GetStoreModel(), modelBuilder);
        }
        /// <summary>
        /// Add MiCake manage model for EFCore.
        /// If you don't inherit <see cref="MiCakeDbContext"/>, you can use this extension method in your DbContent OnModelCreating().
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        public static ModelBuilder AddMiCakeModel(this ModelBuilder builder)
        {
            //EFCore will cached model info.This method only called once
            var storeModelExpression = new EFModelExpressionProvider().GetExpression();

            storeModelExpression.Interpret(StoreConfig.Instance.GetStoreModel(), builder);

            return(builder);
        }