Exemplo n.º 1
0
 public SessionParticipantDisconnectMap()
 {
     Id(x => x.Id).GeneratedBy.GuidComb();
     References(r => r.StudyRoomSession).Column("SessionId").ForeignKey("Session_Disconnect")
     .Not.Nullable().UniqueKey("Session_Disconnect");
     SchemaAction.Update();
 }
Exemplo n.º 2
0
 private void Map()
 {
     Id(x => x.Id).GeneratedBy.GuidComb();
     References(x => x.User).Column("UserId").ForeignKey("UserLocation_User");
     Component(x => x.TimeStamp);
     Map(x => x.Ip).Nullable();
     Map(x => x.Country).Length(10).Nullable();
     Map(x => x.FingerPrint).Nullable();
     Map(x => x.UserAgent).Nullable();
     SchemaAction.Update();
 }
Exemplo n.º 3
0
        public BaseUserMap()
        {
            Id(x => x.Id).GeneratedBy.HiLo(nameof(HiLoGenerator), nameof(HiLoGenerator.NextHi), "10", $"{nameof(HiLoGenerator.TableName)}='User'");
            Map(e => e.Email) /*.Not.Nullable()*/.Unique();
            Map(e => e.Name).Not.Nullable();
            Map(e => e.EmailConfirmed);

            //Map(e => e.NormalizedName);
            //Map(e => e.NormalizedEmail);
            Map(e => e.SecurityStamp);
            Map(e => e.Image).Length(5000).Nullable();
            Map(e => e.ImageName).Length(5000).Nullable();
            Map(e => e.AuthenticatorKey);
            // Map(e => e.Culture);



            Map(e => e.Country).Nullable().Length(2);

            Map(e => e.Created).Insert().Not.Update();
            Map(e => e.Fictive).ReadOnly();


            Map(e => e.OldUser).Nullable();

            References(x => x.University).Column("UniversityId2").ForeignKey("User_University2").Nullable();
            Map(x => x.Language).Column("Language").CustomType <CultureInfo>().Nullable();

            HasMany(x => x.Questions).Access.CamelCaseField(Prefix.Underscore).KeyColumn("UserId")
            .Inverse()
            .Cascade.AllDeleteOrphan();


            HasMany(x => x.Followers).Access.CamelCaseField(Prefix.Underscore)
            .Cascade.AllDeleteOrphan()
            .KeyColumn("UserId").Inverse().AsSet();

            Map(x => x.Score).ReadOnly();
            Table("User"); //if not there is sql error

            DynamicUpdate();
            OptimisticLock.Version();
            Version(x => x.Version).CustomSqlType("timestamp").Generated.Always();
            DiscriminateSubClassesOnColumn("Fictive");

            /*
             * CREATE UNIQUE NONCLUSTERED INDEX idx_phoneNumber_notnull
             * ON sb.[User](PhoneNumberHash)
             * WHERE PhoneNumberHash IS NOT NULL;
             */
            SchemaAction.Update();
        }
Exemplo n.º 4
0
 public TutorHoursMap()
 {
     Id(x => x.Id).GeneratedBy.GuidComb();
     References(x => x.Tutor).Column("TutorId").ForeignKey("Tutor_Hours").Not.Nullable().UniqueKey("tutor_day");
     Component(x => x.AvailabilitySlot, z => {
         z.Map(x => x.Day).Column("WeekDay").CustomType <GenericEnumStringType <DayOfWeek> >().UniqueKey("tutor_day");
         z.Map(x => x.From).Column("From").Not.Nullable().CustomType <NHibernate.Type.TimeAsTimeSpanType>().UniqueKey("tutor_day");
         z.Map(x => x.To).Column("To").Not.Nullable().CustomType <NHibernate.Type.TimeAsTimeSpanType>().UniqueKey("tutor_day");
     });
     Map(x => x.CreateTime).Not.Update();
     Table("TutorHours");
     SchemaAction.Update();
 }