Esempio n. 1
0
        /// <summary>
        /// Maps the AmpPages items.
        /// </summary>
        /// <param name="mappings">The mappings.</param>
        private void MapAmpPageses(List <MappingConfiguration> mappings)
        {
            var mapping = new MappingConfiguration <AmpPage>();

            mapping.MapType(p => new { }).SetTableName("AMP_AmpPages", this.Context);

            mapping.HasProperty(p => p.Id).IsIdentity().IsNotNullable();
            mapping.HasProperty(p => p.Title).IsNotNullable().IsText(this.Context, 255);
            mapping.HasProperty(p => p.ItemType).IsText(this.Context, 255);
            mapping.HasProperty(p => p.UrlName).IsText(this.Context, 255);
            mapping.HasProperty(p => p.PageId);
            mapping.HasProperty(p => p.FieldsListJson).IsNullable().WithInfiniteLength();
            mapping.HasProperty(p => p.ApplicationName);
            mapping.HasProperty(p => p.LastModified);
            mapping.HasProperty(p => p.DateCreated);
            mapping.HasProperty(p => p.LayoutTemplatePath).IsText(this.Context, 255);
            mapping.HasProperty(p => p.TemplatePath).IsText(this.Context, 255);
            mapping.HasProperty(p => p.PageUrl).IsText(this.Context);

            mapping.HasIndex(p => p.Title).IsUnique().WithName("idx_title");
            mapping.HasIndex(p => p.UrlName).IsUnique().WithName("idx_urlName");
            mapping.HasIndex(p => p.PageId).IsUnique().WithName("idx_pageId");

            mappings.Add(mapping);
        }
        /// <summary>
        /// Maps the file data.
        /// </summary>
        /// <param name="mappings">The mappings.</param>
        private void MapFileData(List <MappingConfiguration> mappings)
        {
            var fileDataMapping = new MappingConfiguration <FileData>();

            fileDataMapping.MapType(p => new { }).WithConcurencyControl(OptimisticConcurrencyControlStrategy.None).ToTable("sf_files_monitor_data");
            fileDataMapping.HasProperty(p => p.Id).IsIdentity();
            fileDataMapping.HasProperty(p => p.FileName).ToColumn("file_name");
            fileDataMapping.HasProperty(p => p.FilePath).ToColumn("file_path");
            fileDataMapping.HasProperty(p => p.PackageName).ToColumn("package_name");

            fileDataMapping.HasIndex(p => new { p.FilePath }).IsUnique().WithName("idx_sf_fls_mntr_dta_path");

            mappings.Add(fileDataMapping);
        }
        private static MappingConfiguration<Category> GetCategoryMapping()
        {
            MappingConfiguration<Category> result = new MappingConfiguration<Category>();
            result.MapType(x => new
            {
                CategoryID = x.Id,
                CategoryName = x.Name,
                Description = x.Description
            }).
            ToTable("Categories");

            result.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc);
            result.HasProperty(x => x.Name).WithFixedLength(50);
            result.HasProperty(x => x.Description).WithInfiniteLength();
            result.HasIndex(x => x.Name).WithName("IX_Category").IsUnique();

            return result;
        }
Esempio n. 4
0
        private static MappingConfiguration <Category> GetCategoryMapping()
        {
            MappingConfiguration <Category> result = new MappingConfiguration <Category>();

            result.MapType(x => new
            {
                CategoryID   = x.Id,
                CategoryName = x.Name,
                Description  = x.Description
            }).
            ToTable("Categories");

            result.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc);
            result.HasProperty(x => x.Name).WithFixedLength(50);
            result.HasProperty(x => x.Description).WithInfiniteLength();
            result.HasIndex(x => x.Name).WithName("IX_Category").IsUnique();

            return(result);
        }