本文整理汇总了C#中MappingConfiguration.HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C# MappingConfiguration.HasProperty方法的具体用法?C# MappingConfiguration.HasProperty怎么用?C# MappingConfiguration.HasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MappingConfiguration
的用法示例。
在下文中一共展示了MappingConfiguration.HasProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TeamMapping
private MappingConfiguration TeamMapping()
{
var mapping = new MappingConfiguration<Team>();
mapping.MapType()
.ToTable("Team");
mapping.HasProperty(m => m.Id)
.IsIdentity(KeyGenerator.Autoinc);
mapping.HasProperty(m => m.IsOpen)
.HasColumnType("bit");
mapping.HasAssociation(m => m.Owner)
.IsManaged()
.ToColumn("OwnerId");
mapping.HasAssociation(m => m.Things)
.IsManaged()
.ToColumn("TeamId");
mapping.HasAssociation(m => m.Members)
.WithOpposite(t => t.Team)
.IsManaged()
.IsDependent()
.ToColumn("TeamId");
return mapping;
}
示例2: PrepareMapping
protected override IList<MappingConfiguration> PrepareMapping()
{
List<MappingConfiguration> configurations = new List<MappingConfiguration>();
var saleMapping = new MappingConfiguration<Sale>();
saleMapping.MapType(sale => new
{
ID = sale.Id,
Dish = sale.Dish,
Quantity = sale.Quantity,
Month = sale.Month,
Year = sale.Year
}).ToTable("Sale");
saleMapping.HasProperty(s => s.Id).IsIdentity();
configurations.Add(saleMapping);
var dishReportMapping = new MappingConfiguration<DishReport>();
dishReportMapping.MapType(report => new
{
Month = report.Month,
DeliveredPrice = report.DeliveredPrice,
SoldPrice = report.SoldPrice,
Code = report.Code,
}).ToTable("DishReport");
saleMapping.HasProperty(s => s.Id).IsIdentity();
configurations.Add(dishReportMapping);
return configurations;
}
示例3: PrepareTeamPropertyConfigurations
public void PrepareTeamPropertyConfigurations(MappingConfiguration<Team> configuration)
{
configuration.HasProperty(x => x.TeamId).IsIdentity().HasFieldName("_teamId").WithDataAccessKind(DataAccessKind.ReadWrite);
configuration.HasProperty(x => x.TeamMembers).HasFieldName("_teamMembers").WithDataAccessKind(DataAccessKind.ReadWrite);
configuration.HasProperty(x => x.TeamName).HasFieldName("_teamName").WithDataAccessKind(DataAccessKind.ReadWrite);
configuration.HasProperty(x => x.IsEnabled).HasFieldName("_isEnabled").WithDataAccessKind(DataAccessKind.ReadWrite);
}
示例4: PreparePositionPropertyConfigurations
public void PreparePositionPropertyConfigurations(MappingConfiguration<Position> configuration) {
configuration.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc);
configuration.HasProperty(x => x.HeaderId);
configuration.HasProperty(x => x.Description);
configuration.HasProperty(x => x.SequenceNumber);
configuration.HasProperty(x => x.DateCreated);
configuration.HasProperty(x => x.DateModified);
}
示例5: PrepareRentalRatePropertyConfigurations
public void PrepareRentalRatePropertyConfigurations(MappingConfiguration<RentalRate> configuration)
{
configuration.HasProperty(x => x.RentalRateID).IsIdentity(KeyGenerator.Autoinc).HasFieldName("_rentalRateID").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("RentalRateID").IsNotNullable().HasColumnType("int").HasPrecision(0).HasScale(0);
configuration.HasProperty(x => x.CategoryID).HasFieldName("_categoryID").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("CategoryID").IsNullable().HasColumnType("int").HasPrecision(0).HasScale(0);
configuration.HasProperty(x => x.Daily).HasFieldName("_daily").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("Daily").IsNullable().HasColumnType("smallmoney").HasPrecision(0).HasScale(0);
configuration.HasProperty(x => x.Weekly).HasFieldName("_weekly").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("Weekly").IsNullable().HasColumnType("smallmoney").HasPrecision(0).HasScale(0);
configuration.HasProperty(x => x.Monthly).HasFieldName("_monthly").WithDataAccessKind(DataAccessKind.ReadWrite).ToColumn("Monthly").IsNullable().HasColumnType("smallmoney").HasPrecision(0).HasScale(0);
}
示例6: MapFileData
/// <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");
mappings.Add(fileDataMapping);
}
示例7: PrepareDataAccessCountryPropertyConfigurations
public void PrepareDataAccessCountryPropertyConfigurations(MappingConfiguration<DataAccessCountry> configuration)
{
configuration.HasProperty(x => x.Id)
.IsIdentity(KeyGenerator.Autoinc)
.HasFieldName("id")
.WithDataAccessKind(DataAccessKind.ReadWrite)
.ToColumn("Id")
.IsNotNullable()
.HasColumnType("integer")
.HasPrecision(0)
.HasScale(0);
configuration.HasProperty(x => x.Name)
.HasFieldName("name")
.WithDataAccessKind(DataAccessKind.ReadWrite)
.ToColumn("Name")
.IsNullable()
.HasColumnType("longtext")
.HasLength(0);
configuration.HasProperty(x => x.Region)
.HasFieldName("region")
.WithDataAccessKind(DataAccessKind.ReadWrite)
.ToColumn("Region")
.IsNotNullable()
.HasColumnType("integer")
.HasPrecision(0)
.HasScale(0);
}
开发者ID:kalinalazarova1,项目名称:TeamGiant-DatabaseProject,代码行数:27,代码来源:VehicleVendorCustomMetadataSource.cs
示例8: GetMapping
public static MappingConfiguration GetMapping()
{
var mapping = new MappingConfiguration<Instance>();
mapping.MapType().ToTable("Instances");
mapping.HasProperty(p => p.SurrogateInstanceId).IsIdentity(KeyGenerator.Autoinc);
mapping.HasProperty(p => p.PrimitiveDataProperties).WithInfiniteLength().IsNullable();
mapping.HasProperty(p => p.ComplexDataProperties).WithInfiniteLength().IsNullable();
mapping.HasProperty(p => p.WriteOnlyPrimitiveDataProperties).WithInfiniteLength().IsNullable();
mapping.HasProperty(p => p.WriteOnlyComplexDataProperties).WithInfiniteLength().IsNullable();
mapping.HasProperty(p => p.MetadataProperties).WithInfiniteLength().IsNullable();
mapping.HasProperty(p => p.SuspensionExceptionName).WithVariableLength(450).IsNullable().IsUnicode();
mapping.HasProperty(p => p.SuspensionReason).WithInfiniteLength().IsUnicode().IsNullable();
mapping.HasProperty(p => p.BlockingBookmarks).WithInfiniteLength().IsUnicode().IsNullable();
mapping.HasProperty(p => p.LastMachineRunOn).WithVariableLength(450).IsUnicode().IsNullable();
return mapping;
}
示例9: PrepareMapping
protected override IList<MappingConfiguration> PrepareMapping()
{
List<MappingConfiguration> configurations = new List<MappingConfiguration>();
MappingConfiguration<Report> reportConfiguration = new MappingConfiguration<Report>();
reportConfiguration.MapType(x => new
{
ID = x.Id,
Name = x.Name,
Duration = x.Duration,
Destination = x.Destination,
ClientsCount = x.ClientsCount,
TotalIncome = x.TotalIncome,
TransportCompany = x.TransportCompany,
TransportType = x.TransportType,
GuideName = x.GuideName,
ExpenseId = x.ExpenseId
}).ToTable("Reports");
reportConfiguration.HasProperty(p => p.Id).IsIdentity(KeyGenerator.Autoinc);
configurations.Add(reportConfiguration);
return configurations;
}
示例10: MapItem
private void MapItem(IList<MappingConfiguration> mappings)
{
var itemMapping = new MappingConfiguration<ProductItem>();
itemMapping.HasProperty(p => p.Id).IsIdentity();
itemMapping.MapType(p => new { }).ToTable("custom_products");
itemMapping.HasProperty(p => p.Price);
itemMapping.HasProperty(p => p.QuantityInStock);
itemMapping.HasAssociation<Telerik.Sitefinity.Security.Model.Permission>(p => p.Permissions);
itemMapping.HasProperty(p => p.InheritsPermissions);
itemMapping.HasProperty(p => p.CanInheritPermissions);
itemMapping.HasAssociation(p => p.Urls).WithOppositeMember("parent","Parent").ToColumn("content_id").IsDependent().IsManaged();
//map language data & published translations
CommonFluentMapping.MapILifecycleDataItemFields<ProductItem>(itemMapping, this.Context);
mappings.Add(itemMapping);
}
示例11: CreateQuestionMapping
private MappingConfiguration<Question> CreateQuestionMapping()
{
MappingConfiguration<Question> questionMapping = new MappingConfiguration<Question>();
questionMapping.MapType(question => new
{
QuestionId = question.Id,
QueryText = question.QueryText,
PostedById = question.PostedById
})
.ToTable("Questions");
questionMapping.HasProperty(q => q.Id).IsIdentity();
questionMapping.HasAssociation(q => q.PostedBy)
.WithOpposite(u => u.CreatedQuestions)
.HasConstraint((q, u) => q.PostedById == u.Id);
questionMapping.HasAssociation(q => q.UsersThatVoted)
.WithOpposite(u => u.VotedOnQuestions)
.IsManaged()
.MapJoinTable("QuestionsUsers", (q, u) => new
{
QuestionGuid = q.Id,
UserGuid = u.Id
});
questionMapping.HasAssociation(q => q.Answers)
.WithOpposite(a => a.Question)
.HasConstraint((q, a) => q.Id == a.QuestionId)
.IsManaged();
return questionMapping;
}
示例12: GetCategoryMapping
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;
}
示例13: PrepareGroupMappingConfig
private MappingConfiguration<Group> PrepareGroupMappingConfig()
{
MappingConfiguration<Group> groupMappingConfig = new MappingConfiguration<Group>();
groupMappingConfig.MapType().ToTable("Groups");
//backend independent property mapping
groupMappingConfig.HasProperty(grp => grp.GroupId).IsIdentity().WithOpenAccessType(OpenAccessType.Int32).ToColumn("GroupId");
groupMappingConfig.HasProperty(grp => grp.Name).WithOpenAccessType(OpenAccessType.StringInfiniteLength).ToColumn("Name");
groupMappingConfig.HasProperty(grp => grp.Description).WithOpenAccessType(OpenAccessType.StringInfiniteLength).ToColumn("Description");
groupMappingConfig.HasAssociation(grp => grp.UsersInGroup)
.WithOpposite(usr => usr.Group)
.HasConstraint((grp, usr) => grp.GroupId == usr.GroupId)
.IsManaged();
return groupMappingConfig;
}
示例14: CreateIdentityRoleMapping
private MappingConfiguration<IdentityRole> CreateIdentityRoleMapping()
{
MappingConfiguration<IdentityRole> identityRoleMapping = new MappingConfiguration<IdentityRole>();
identityRoleMapping.MapType(role => new
{
id = role.Id,
Name = role.Name
}).ToTable("IdentityRoles");
identityRoleMapping.HasProperty(x => x.Id).IsIdentity();
return identityRoleMapping;
}
示例15: CraeteIdentityUserMapping
private MappingConfiguration<IdentityUser> CraeteIdentityUserMapping()
{
MappingConfiguration<IdentityUser> identityUserMapping = new MappingConfiguration<IdentityUser>();
identityUserMapping.MapType(user => new
{
Id = user.Id,
Name = user.UserName,
PasswordHash = user.PasswordHash
}).ToTable("IdentityUsers");
identityUserMapping.HasProperty(x => x.Id).IsIdentity();
return identityUserMapping;
}