Пример #1
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        { 
            ICoreModelMapper mapper = this.GetService<ICoreModelMapper>();
            if(mapper == null)
            {
                mapper = new SqlServerCoreModelMapper();
            }


            modelBuilder.Entity<SiteSettings>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity<SiteHost>(entity =>
            {
                mapper.Map(entity);
            });
            
            modelBuilder.Entity<SiteUser>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity<SiteRole>(entity =>
            {
                entity.Ignore(x => x.MemberCount);

                mapper.Map(entity);
            });

            modelBuilder.Entity<UserClaim>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity<UserLogin>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity<GeoCountry>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity<GeoZone>(entity =>
            {
                mapper.Map(entity);
            });
            
            modelBuilder.Entity<UserRole>(entity =>
            {
                mapper.Map(entity);
            });
            
            modelBuilder.Entity<UserLocation>(entity =>
            {
                mapper.Map(entity);
            });

            // should this be called before or after we do our thing?

            base.OnModelCreating(modelBuilder);

        }
Пример #2
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            ICoreModelMapper mapper = this.GetService <ICoreModelMapper>();

            if (mapper == null)
            {
                mapper = new SqlServerCoreModelMapper();
            }


            modelBuilder.Entity <SiteSettings>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <SiteHost>(entity =>
            {
                mapper.Map(entity);
            });

            //modelBuilder.Entity<SiteFolder>(entity =>
            //{
            //    mapper.Map(entity);
            //});

            modelBuilder.Entity <SiteUser>(entity =>
            {
                //entity.Ignore(x => x.Id);
                mapper.Map(entity);
            });

            modelBuilder.Entity <SiteRole>(entity =>
            {
                entity.Ignore(x => x.MemberCount);

                mapper.Map(entity);
            });

            modelBuilder.Entity <UserClaim>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <UserLogin>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <GeoCountry>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <GeoZone>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <Currency>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <Language>(entity =>
            {
                mapper.Map(entity);
            });



            modelBuilder.Entity <UserRole>(entity =>
            {
                mapper.Map(entity);


                // entity.Property(p => p.RoleId).HasAnnotation()
            });

            //ForeignKeyAttribute fkr = new ForeignKeyAttribute("RoleId");
            //ForeignKeyAttribute fku = new ForeignKeyAttribute("UserId");

            //modelBuilder.Entity<UserRole>()
            //    .HasAnnotation()
            //    ;


            modelBuilder.Entity <UserLocation>(entity =>
            {
                mapper.Map(entity);
            });

            // should this be called before or after we do our thing?

            base.OnModelCreating(modelBuilder);
        }
Пример #3
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            ICoreModelMapper mapper = this.GetService <ICoreModelMapper>();

            if (mapper == null)
            {
                mapper = new SqlServerCoreModelMapper();
            }


            modelBuilder.Entity <SiteSettings>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <SiteHost>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <SiteUser>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <SiteRole>(entity =>
            {
                entity.Ignore(x => x.MemberCount);

                mapper.Map(entity);
            });

            modelBuilder.Entity <UserClaim>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <UserLogin>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <GeoCountry>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <GeoZone>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <UserRole>(entity =>
            {
                mapper.Map(entity);
            });

            modelBuilder.Entity <UserLocation>(entity =>
            {
                mapper.Map(entity);
            });

            // should this be called before or after we do our thing?

            base.OnModelCreating(modelBuilder);
        }