本文整理汇总了C#中MappingConfiguration.MapType方法的典型用法代码示例。如果您正苦于以下问题:C# MappingConfiguration.MapType方法的具体用法?C# MappingConfiguration.MapType怎么用?C# MappingConfiguration.MapType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MappingConfiguration
的用法示例。
在下文中一共展示了MappingConfiguration.MapType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapUrlData
/// <summary>
/// Maps the ProjectItemUrlData class
/// </summary>
/// <param name="mappings">The LocatoinItemUrlData class mappings.</param>
private void MapUrlData(IList<MappingConfiguration> mappings)
{
// map the Url data type
var urlDataMapping = new MappingConfiguration<ProjectItemUrlData>();
urlDataMapping.MapType(p => new { }).Inheritance(InheritanceStrategy.Flat).ToTable("sf_url_data");
mappings.Add(urlDataMapping);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: GetRentalRateClassConfiguration
public MappingConfiguration<RentalRate> GetRentalRateClassConfiguration()
{
MappingConfiguration<RentalRate> configuration = new MappingConfiguration<RentalRate>();
configuration.MapType(x => new { }).WithConcurencyControl(OptimisticConcurrencyControlStrategy.Changed).ToTable("RentalRates");
return configuration;
}
示例6: GetTeamClassConfiguration
public MappingConfiguration<Team> GetTeamClassConfiguration()
{
MappingConfiguration<Team> configuration = new MappingConfiguration<Team>();
configuration.MapType().WithDataAccessKind(DataAccessKind.ReadWrite);
return configuration;
}
示例7: 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;
}
示例8: GetJobScheduleClassConfiguration
public MappingConfiguration<JobSchedule> GetJobScheduleClassConfiguration()
{
var configuration = new MappingConfiguration<JobSchedule>();
configuration.MapType(x => new { })
.WithConcurencyControl(Changed)
.ToTable("js_JobSchedules");
return configuration;
}
示例9: 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);
}
示例10: 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;
}
示例11: 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;
}
示例12: GetTable
private MappingConfiguration<CLASSNAME> GetTable()
{
MappingConfiguration<Position> configuration = new MappingConfiguration<CLASSNAME>();
configuration.MapType()
.Inheritance(Telerik.OpenAccess.InheritanceStrategy.Flat)
.WithConcurencyControl(OptimisticConcurrencyControlStrategy.Version);
configuration.HasProperty(x => x.Id).IsIdentity(KeyGenerator.Autoinc);
//configuration.HasIndex(x => new {
// x.Price,
// x.ProductName
//}).IsUnique()
//.IsClustered()
return configuration;
}
示例13: PrepareMapping
protected override IList<MappingConfiguration> PrepareMapping()
{
List<MappingConfiguration> configurations = new List<MappingConfiguration>();
var stefan = new MappingConfiguration<Stefan>();
stefan.MapType(s => new
{
ID = s.StefanID,
Name = s.Name,
}).ToTable("Stefan");
stefan.HasProperty(s => s.StefanID).IsIdentity();
configurations.Add(stefan);
return configurations;
}
示例14: 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;
}
示例15: 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);
}