public void CanRaiseAddEvent()
        {
            using (var context = GetNewContextInstance())
            {
                EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();

                bool eventRaised = false;

                context.OnAuditLogGenerated += (sender, args) =>
                {
                    if (args.Log.EventType == EventType.Added &&
                        args.Log.TypeFullName == typeof(TrackedModelWithMultipleProperties).FullName)
                    {
                        eventRaised = true;
                    }
                };

                var entity = GetObjectFactory <TrackedModelWithMultipleProperties>().Create(false);

                entity.Description = RandomText;

                context.TrackedModelsWithMultipleProperties.Add(entity);

                context.SaveChanges();

                //assert
                Assert.IsTrue(eventRaised);

                //make sure log is saved in database
                entity.AssertAuditForAddition(context, entity.Id, null,
                                              x => x.Id,
                                              x => x.Description);
            }
        }
        public void Should_Log_EmptyProperties_When_Configured_WhileDeleting()
        {
            //arrange
            EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();
            GlobalTrackingConfig.TrackEmptyPropertiesOnAdditionAndDeletion = true;

            var entity = new TrackedModelWithMultipleProperties();

            Db.TrackedModelsWithMultipleProperties.Add(entity);
            Db.SaveChanges();


            //act
            Db.TrackedModelsWithMultipleProperties.Remove(entity);
            Db.SaveChanges();

            //assert
            entity.AssertAuditForDeletion(Db, entity.Id, null,
                                          x => x.Id,
                                          x => x.Description,
                                          x => x.IsSpecial,
                                          x => x.Name,
                                          x => x.StartDate,
                                          x => x.Value);
        }
        public void Should_Log_EmptyProperties_When_Configured_WhileDeleting()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            //arrange
            EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();
            GlobalTrackingConfig.TrackEmptyPropertiesOnAdditionAndDeletion = true;

            var entity = new TrackedModelWithMultipleProperties();

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.TrackedModelWithMultipleProperties.Add(entity);
                ttc.SaveChanges();

                //act
                ttc.TrackedModelWithMultipleProperties.Remove(entity);
                ttc.SaveChanges();

                //assert
                entity.AssertAuditForDeletion(ttc, entity.Id, null,
                                              x => x.Id,
                                              x => x.Description,
                                              x => x.IsSpecial,
                                              x => x.Name,
                                              x => x.StartDate,
                                              x => x.Value);
            }
        }
Ejemplo n.º 4
0
        public CustomPageMap()
        {
            this.ToTable("CustomPage");
            this.HasKey(cp => cp.Id);
            this.Property(b => b.BodyHtml).IsOptional();
            this.Property(b => b.DisplayOrder).IsOptional();
            this.Property(b => b.IncludeInFooterColumn1).IsOptional();
            this.Property(b => b.IncludeInFooterColumn2).IsOptional();
            this.Property(b => b.IncludeInFooterColumn3).IsOptional();
            this.Property(b => b.IncludeInFooterMenu).IsOptional();
            this.Property(b => b.IncludeInTopMenu).IsOptional();
            this.Property(b => b.MetaDescription).IsOptional();
            this.Property(b => b.MetaKeywords).IsOptional();
            this.Property(b => b.MetaTitle).IsOptional();
            this.Property(b => b.Name).IsRequired();
            this.Property(b => b.PermissionOriented).IsOptional();
            this.Property(b => b.PermissionRecordId).IsOptional();
            this.Property(b => b.SystemName).IsOptional();
            this.Property(b => b.TemplateId).IsRequired();
            this.Property(b => b.Url).IsOptional();

            // Relationships
            this.HasRequired(temp => temp.Template)
            .WithMany()
            .HasForeignKey(temp => temp.TemplateId);
            this.HasRequired(cust => cust.User)
            .WithMany()
            .HasForeignKey(cust => cust.UserId);
            this.HasOptional(cust => cust.PermissionRecord)
            .WithMany()
            .HasForeignKey(cust => cust.PermissionRecordId);

            EntityTracker.TrackAllProperties <CustomPage>().Except(x => x.User).And(x => x.PermissionRecord).And(x => x.ModifiedOn).And(x => x.CreatedOn);
        }
Ejemplo n.º 5
0
        public TeacherExamMap()
        {
            this.ToTable("Teacher_Exam");
            this.HasKey(b => b.Id);
            this.Property(b => b.AcadmicYearId).IsRequired();
            this.Property(b => b.BreakAllowed).IsOptional();
            this.Property(b => b.BreakTime).HasMaxLength(20).IsOptional();
            this.Property(b => b.ClassRoomId).IsRequired();
            this.Property(b => b.EndDate).IsOptional();
            this.Property(b => b.EndTime).HasMaxLength(20).IsOptional();
            this.Property(b => b.ExamId).IsRequired();
            this.Property(b => b.GradeSystemId).IsOptional();
            this.Property(b => b.MarksObtained).IsOptional();
            this.Property(b => b.ResultStatusId).IsOptional();
            this.Property(b => b.StartDate).IsOptional();
            this.Property(b => b.StartTime).HasMaxLength(20).IsOptional();
            this.Property(b => b.TeacherId).IsRequired();
            this.Property(b => b.PassingMarks).IsOptional();
            this.Property(b => b.MaxMarks).IsOptional();


            // Relationships
            this.HasMany(e => e.Comments).WithMany(c => c.TeacherExams).Map(m => m.ToTable("Teacher_Exam_Comment_Map").MapLeftKey("TeacherExamId").MapRightKey("CommentId"));
            this.HasRequired(ca => ca.Teacher).WithMany(e => e.TeacherExams).HasForeignKey(ca => ca.TeacherId);
            this.HasRequired(ca => ca.Exam).WithMany(e => e.TeacherExams).HasForeignKey(ca => ca.ExamId);
            this.HasRequired(ca => ca.ClassRoom).WithMany().HasForeignKey(ca => ca.ClassRoomId);
            EntityTracker.TrackAllProperties <TeacherExam>().Except(x => x.CreatedOn).And(x => x.ModifiedOn).And(x => x.ClassRoom).And(x => x.Teacher).And(x => x.Exam);
        }
Ejemplo n.º 6
0
        public async Task ShouldAddSingleMetadata_WhenSingleMetadataIsProvided_Async()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.ConfigureMetadata(m =>
                {
                    m.IpAddress = "192.168.2.23";
                });

                EntityTracker.TrackAllProperties <POCO>();
                POCO entity = new POCO();

                ttc.POCOes.Add(entity);
                await ttc.SaveChangesAsync("bilal");

                entity.AssertAuditForAddition(ttc, entity.Id, "bilal",
                                              x => x.Color, x => x.Height, x => x.StartTime, x => x.Id);

                entity.AssertMetadata(ttc, entity.Id, new Dictionary <string, string>
                {
                    ["IpAddress"] = "192.168.2.23"
                });
            }
        }
Ejemplo n.º 7
0
        public void should_update_with_no_logs()
        {
            EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();

            var entity = ObjectFactory.Create <TrackedModelWithMultipleProperties>(save: true);

            TrackedModelWithMultipleProperties newEntity = new TrackedModelWithMultipleProperties
            {
                Id          = entity.Id,
                Description = entity.Description,
                IsSpecial   = entity.IsSpecial,
                Name        = entity.Name,
                StartDate   = entity.StartDate,
                Value       = entity.Value,
                Category    = entity.Category
            };

            TestTrackerContext newContext2 = GetNewContextInstance(options);

            newContext2.TrackedModelsWithMultipleProperties.Attach(newEntity);
            newContext2.Entry(newEntity).State = EntityState.Modified;
            newContext2.SaveChanges();

            newEntity.AssertNoLogs(newContext2, newEntity.Id, EventType.Modified);
        }
Ejemplo n.º 8
0
        public void ShouldNotAddMetadata_WhenValueIsNull()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.ConfigureMetadata(m =>
                {
                    m.IpAddress = "192.168.2.23";
                    m.Country   = null;
                    m.Device    = string.Empty;
                });

                EntityTracker.TrackAllProperties <POCO>();
                POCO entity = new POCO();

                ttc.POCOes.Add(entity);
                ttc.SaveChanges();

                entity.AssertAuditForAddition(ttc, entity.Id, null,
                                              x => x.Color, x => x.Height, x => x.StartTime, x => x.Id);

                entity.AssertMetadata(ttc, entity.Id, new Dictionary <string, string>
                {
                    ["IpAddress"] = "192.168.2.23",
                    ["Device"]    = string.Empty
                });
            }
        }
Ejemplo n.º 9
0
        public ProductMap()
        {
            this.ToTable("Product");
            this.HasKey(pro => pro.Id);
            this.Property(b => b.Description).IsOptional();
            this.Property(b => b.Description).IsOptional();
            this.Property(b => b.Name).IsRequired();
            this.Property(b => b.VendorId).IsOptional();
            this.Property(b => b.MetaDescription).IsOptional();
            this.Property(b => b.MetaKeywords).IsOptional();
            this.Property(b => b.MetaTitle).IsOptional();
            this.Property(b => b.MarkAsNewStartDate).IsOptional();
            this.Property(b => b.MarkAsNewEndDate).IsOptional();
            this.Property(b => b.MarkAsNew).IsOptional();
            this.Property(b => b.IsUpcoming).IsOptional();
            this.Property(b => b.DisableBuyButton).IsOptional();
            this.Property(b => b.AvailableEndDate).IsOptional();
            this.Property(b => b.AvailableStartDate).IsOptional();
            this.Property(b => b.AcadmicYearId).IsOptional();
            this.Property(b => b.OldPrice).IsOptional();
            this.Property(b => b.BasePrice).IsRequired();
            this.Property(b => b.Price).IsRequired();
            this.Property(b => b.StockQuantity).IsRequired();

            // Relationships
            this.HasMany(pro => pro.Files).WithMany(p => p.Products).Map(m => m.ToTable("Product_File_Map").MapLeftKey("ProductId").MapRightKey("FileId"));
            this.HasMany(pro => pro.Comments).WithMany(p => p.Products).Map(m => m.ToTable("Product_Comment_Map").MapLeftKey("ProductId").MapRightKey("CommentId"));

            EntityTracker.TrackAllProperties <Product>().Except(x => x.Pictures).And(x => x.AcadmicYearId).And(x => x.ModifiedOn).And(x => x.CreatedOn);
        }
        public void CanSkipTrackingUsingEvent()
        {
            using (TestTrackerContext context = GetNewContextInstance())
            {
                EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();

                bool eventRaised = false;

                context.OnAuditLogGenerated += (sender, args) =>
                {
                    TrackedModelWithMultipleProperties eventEntity = args.Entity as TrackedModelWithMultipleProperties;

                    if (args.Log.EventType == EventType.Added &&
                        args.Log.TypeFullName == typeof(TrackedModelWithMultipleProperties).FullName &&
                        eventEntity != null)
                    {
                        eventRaised        = true;
                        args.SkipSavingLog = true;
                    }
                };

                TrackedModelWithMultipleProperties entity = ObjectFactory.Create <TrackedModelWithMultipleProperties>(save: true, testDbContext: context);

                //assert
                Assert.IsTrue(eventRaised);

                //make sure log is saved in database
                entity.AssertNoLogs(context, entity.Id, EventType.Added);
            }
        }
Ejemplo n.º 11
0
        public StudentExamMap()
        {
            this.ToTable("Student_Exam_Mapping");
            this.HasKey(b => b.Id);
            this.Property(b => b.StudentId).IsRequired();
            this.Property(b => b.ExamId).IsRequired();
            this.Property(b => b.BreakAllowed).IsOptional();
            this.Property(b => b.BreakTime).HasMaxLength(20).IsOptional();
            this.Property(b => b.ClassRoomId).IsRequired();
            this.Property(b => b.EndDate).IsOptional();
            this.Property(b => b.EndTime).HasMaxLength(20).IsOptional();
            this.Property(b => b.GradeSystemId).IsOptional();
            this.Property(b => b.MarksObtained).IsOptional();
            this.Property(b => b.ResultStatusId).IsOptional();
            this.Property(b => b.StartDate).IsOptional();
            this.Property(b => b.StartTime).HasMaxLength(20).IsOptional();
            this.Property(b => b.PassingMarks).IsOptional();
            this.Property(b => b.MaxMarks).IsOptional();


            this.HasMany(e => e.Comments).WithMany(c => c.StudentExams).Map(m => m.ToTable("Student_Exam_Comment_Map").MapLeftKey("StudentExamId").MapRightKey("CommentId"));
            this.HasRequired(all => all.Student).WithMany(e => e.StudentExams).HasForeignKey(all => all.StudentId);
            this.HasRequired(all => all.Exam).WithMany(e => e.StudentExams).HasForeignKey(all => all.ExamId);
            this.HasRequired(all => all.ClassRoom).WithMany().HasForeignKey(all => all.ClassRoomId);

            EntityTracker.TrackAllProperties <StudentExam>().Except(x => x.Student).And(x => x.Exam).And(x => x.ClassRoom).And(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
        public void CanRaiseDeleteEvent()
        {
            using (TestTrackerContext context = GetNewContextInstance())
            {
                EntityTracker.TrackAllProperties <NormalModel>();

                bool eventRaised = false;

                context.OnAuditLogGenerated += (sender, args) =>
                {
                    NormalModel eventEntity = args.Entity as NormalModel;

                    if (args.Log.EventType == EventType.Deleted &&
                        args.Log.TypeFullName == typeof(NormalModel).FullName &&
                        eventEntity != null)
                    {
                        eventRaised = true;
                    }
                };

                NormalModel existingEntity = ObjectFactory
                                             .Create <NormalModel>(save: true, testDbContext: context);

                context.NormalModels.Remove(existingEntity);
                context.SaveChanges();

                //assert
                Assert.IsTrue(eventRaised);

                existingEntity.AssertAuditForDeletion(context, existingEntity.Id, null,
                                                      x => x.Description,
                                                      x => x.Id);
            }
        }
Ejemplo n.º 13
0
        public void should_be_able_to_delete()
        {
            EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>()
            .Except(x => x.IsSpecial);

            TrackedModelWithMultipleProperties existingModel =
                ObjectFactory
                .Create <TrackedModelWithMultipleProperties>(save: true);

            var newModel = new TrackedModelWithMultipleProperties
            {
                Id = existingModel.Id
            };

            TestTrackerContext newContextInstance = GetNewContextInstance(options);

            newContextInstance.TrackedModelsWithMultipleProperties.Attach(newModel);
            newContextInstance.Entry(newModel).State = EntityState.Deleted;

            newContextInstance.SaveChanges();

            existingModel.AssertAuditForDeletion(newContextInstance, newModel.Id,
                                                 null,
                                                 model => model.Id,
                                                 model => model.Name,
                                                 model => model.StartDate,
                                                 model => model.Value,
                                                 model => model.Category,
                                                 model => model.Description
                                                 );
        }
        public void Should_Not_Log_When_Value_Not_changed()
        {
            //arrange
            EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();

            string oldDescription = RandomText;

            var entity = new TrackedModelWithMultipleProperties()
            {
                Description = oldDescription,
                StartDate   = RandomDate,
            };

            Db.TrackedModelsWithMultipleProperties.Add(entity);
            Db.SaveChanges();

            entity.AssertAuditForAddition(Db, entity.Id,
                                          null,
                                          x => x.Id,
                                          x => x.Description,
                                          x => x.StartDate);

            //make change to state
            Db.Entry(entity).State = EntityState.Modified;
            Db.SaveChanges();

            //make sure there are no unnecessaary logs
            entity.AssertNoLogs(Db, entity.Id, EventType.Modified);
        }
Ejemplo n.º 15
0
        public void should_be_able_to_delete()
        {
            EntityTracker.TrackAllProperties <TrackedModelWithMultipleProperties>();
            TrackedModelWithMultipleProperties existingModel = GetDisconnectedExistingComplexModel();

            TestTrackerContext newContextInstance = GetNewContextInstance();

            var newModel = new TrackedModelWithMultipleProperties
            {
                Id = existingModel.Id
            };

            newContextInstance.TrackedModelsWithMultipleProperties.Attach(newModel);
            newContextInstance.Entry(newModel).State = EntityState.Deleted;

            newContextInstance.SaveChanges();

            existingModel.AssertAuditForDeletion(newContextInstance, newModel.Id,
                                                 null,
                                                 model => model.Id,
                                                 model => model.IsSpecial,
                                                 model => model.Name,
                                                 model => model.StartDate,
                                                 model => model.Value,
                                                 model => model.Description
                                                 );
        }
Ejemplo n.º 16
0
        public SchoolMap()
        {
            this.ToTable("School");
            this.HasKey(ui => ui.Id);
            this.Property(b => b.AcadmicYearId).IsRequired();
            this.Property(b => b.AffiliationNumber).IsOptional();
            this.Property(b => b.City).IsOptional();
            this.Property(b => b.State).IsOptional();
            this.Property(b => b.Country).IsOptional();
            this.Property(b => b.CoverPictureId).IsOptional();
            this.Property(b => b.FacebookLink).IsOptional();
            this.Property(b => b.FreelancerLink).IsOptional();
            this.Property(b => b.FullName).IsRequired();
            this.Property(b => b.GooglePlusLink).IsOptional();
            this.Property(b => b.GuruLink).IsOptional();
            this.Property(b => b.InstagramLink).IsOptional();
            this.Property(b => b.Landmark).IsOptional();
            this.Property(b => b.Latitude).IsOptional();
            this.Property(b => b.LinkedInLink).IsOptional();
            this.Property(b => b.Longitude).IsOptional();
            this.Property(b => b.PInterestLink).IsOptional();
            this.Property(b => b.ProfilePictureId).IsOptional();
            this.Property(b => b.RegistrationNumber).IsOptional();
            this.Property(b => b.Street1).IsOptional();
            this.Property(b => b.Street2).IsOptional();
            this.Property(b => b.TweeterLink).IsOptional();
            this.Property(b => b.UpworkLink).IsOptional();
            this.Property(b => b.UserName).IsOptional();
            this.Property(b => b.ZipCode).IsOptional();
            this.Property(b => b.Email).IsRequired();

            //relationship
            this.HasRequired(cust => cust.User).WithMany().HasForeignKey(cust => cust.UserId);
            EntityTracker.TrackAllProperties <School>().Except(x => x.User).And(x => x.AcadmicYearId).And(x => x.ModifiedOn).And(x => x.CreatedOn);
        }
Ejemplo n.º 17
0
        public void Can_recognise_global_tracking_indicator_when_enabled()
        {
            var options = new DbContextOptionsBuilder <TestTrackerContext>()
                          .UseSqlServer(TestConnectionString)
                          .Options;

            EntityTracker
            .TrackAllProperties <POCO>();

            POCO model = new POCO
            {
                Color     = "Red",
                Height    = 67.4,
                StartTime = new DateTime(2015, 5, 5)
            };

            using (TestTrackerContext ttc = new TestTrackerContext(options))
            {
                ttc.POCOes.Add(model);
                ttc.SaveChanges();

                model.AssertAuditForAddition(ttc, model.Id, null,
                                             x => x.Color,
                                             x => x.Id,
                                             x => x.Height,
                                             x => x.StartTime);
            }
        }
Ejemplo n.º 18
0
 public PermissionRecordMap()
 {
     this.ToTable("Permission");
     this.HasKey(per => per.Id);
     this.Property(b => b.Name).IsRequired();
     this.Property(b => b.SystemName).IsOptional();
     EntityTracker.TrackAllProperties <PermissionRecord>().Except(x => x.IsSystemDefined).And(x => x.ModifiedOn).And(x => x.CreatedOn);
 }
Ejemplo n.º 19
0
        public IPAddressMap()
        {
            this.ToTable("IPAddress");
            this.HasKey(ip => ip.Id);

            //relationship
            EntityTracker.TrackAllProperties <Location>().Except(x => x.User).And(x => x.ModifiedOn).And(x => x.CreatedOn);
        }
Ejemplo n.º 20
0
 public DivisionMap()
 {
     this.ToTable("Division");
     this.HasKey(b => b.Id);
     this.Property(b => b.Description).IsOptional();
     this.Property(b => b.Name).IsRequired();
     EntityTracker.TrackAllProperties <Division>().Except(x => x.CreatedOn).And(x => x.ModifiedOn);
 }
Ejemplo n.º 21
0
        public AcadmicYearMap()
        {
            this.ToTable("AcadamicYear");
            this.HasKey(b => b.Id);
            this.Property(b => b.Name).IsRequired();

            this.HasRequired(all => all.User).WithMany().HasForeignKey(all => all.UserId);
            EntityTracker.TrackAllProperties <AcadmicYear>().Except(x => x.User).And(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
Ejemplo n.º 22
0
        public ClassRoomMap()
        {
            this.ToTable("Class_Room");
            this.HasKey(b => b.Id);
            this.Property(b => b.Description).IsOptional();
            this.Property(b => b.Number).IsRequired();

            EntityTracker.TrackAllProperties <ClassRoom>().Except(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
Ejemplo n.º 23
0
        public CasteMap()
        {
            this.ToTable("Caste");
            this.HasKey(b => b.Id);
            this.Property(b => b.Name).HasMaxLength(100).IsRequired();
            this.Property(b => b.ReligionId).IsRequired();

            this.HasRequired(all => all.Religion).WithMany().HasForeignKey(all => all.ReligionId);
            EntityTracker.TrackAllProperties <Caste>().Except(x => x.Religion).And(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
Ejemplo n.º 24
0
        public ClassMap()
        {
            this.ToTable("Class");
            this.HasKey(b => b.Id);
            this.Property(b => b.Name).IsRequired();
            this.Property(b => b.AcadmicYearId).IsRequired();
            this.Property(b => b.DisplayOrder).IsRequired();

            EntityTracker.TrackAllProperties <Class>().Except(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
Ejemplo n.º 25
0
        public CategoryMap()
        {
            this.ToTable("Category");
            this.HasKey(b => b.Id);
            this.Property(b => b.Name).IsRequired();

            // Relationships
            this.HasMany(pro => pro.Castes).WithMany(p => p.Categories).Map(m => m.ToTable("Category_Caste_Map").MapLeftKey("CategoryId").MapRightKey("CasteId"));
            EntityTracker.TrackAllProperties <Category>().Except(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
Ejemplo n.º 26
0
        public HomeworkMap()
        {
            this.ToTable("Homework");
            this.HasKey(b => b.Id);
            this.Property(b => b.AcadmicYearId).IsRequired();
            this.Property(b => b.Description).IsOptional();
            this.Property(b => b.Name).IsRequired();

            EntityTracker.TrackAllProperties <Homework>().Except(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
Ejemplo n.º 27
0
        public HouseMap()
        {
            this.ToTable("House");
            this.HasKey(b => b.Id);
            this.Property(e => e.AcadmicYearId).IsRequired();
            this.Property(e => e.Description).IsOptional();
            this.Property(e => e.Name).IsRequired();

            EntityTracker.TrackAllProperties <House>().Except(x => x.Picture).And(x => x.Students).And(x => x.CreatedOn).And(x => x.ModifiedOn);
        }
        public void Can_recognise_global_tracking_indicator_when_disabled()
        {
            GlobalTrackingConfig.Enabled = false;
            EntityTracker
            .TrackAllProperties <POCO>();

            POCO model = ObjectFactory.Create <POCO>(false, true, Db);

            model.AssertNoLogs(Db, model.Id);
        }
Ejemplo n.º 29
0
        public VideosMap()
        {
            this.ToTable("Video");
            this.HasKey(v => v.Id);
            this.Property(b => b.DisplayOrder).IsOptional();
            this.Property(b => b.Size).IsOptional();
            this.Property(b => b.Url).IsOptional();
            this.Property(b => b.VideoSrc).IsRequired();

            EntityTracker.TrackAllProperties <Video>().Except(x => x.Blogs).And(x => x.Events).And(x => x.Products).And(x => x.ModifiedOn).And(x => x.CreatedOn);
        }
Ejemplo n.º 30
0
        public BookMap()
        {
            this.ToTable("Book");
            this.HasKey(b => b.Id);
            this.Property(b => b.Description).IsOptional();
            this.Property(b => b.Price).IsOptional();
            this.Property(b => b.Author).IsOptional();
            this.Property(b => b.Name).IsRequired();

            EntityTracker.TrackAllProperties <Book>().Except(x => x.CreatedOn).And(x => x.ModifiedOn);
        }