本文整理汇总了C#中NHibernate.Mapping.List.Any方法的典型用法代码示例。如果您正苦于以下问题:C# List.Any方法的具体用法?C# List.Any怎么用?C# List.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Mapping.List
的用法示例。
在下文中一共展示了List.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeDataProperty
/// <summary>
/// Make data property metadata for the entity
/// </summary>
/// <param name="propName">name of the property on the server</param>
/// <param name="typeName">data type of the property, e.g. Int32</param>
/// <param name="isNullable">whether the property is nullable in the database</param>
/// <param name="col">Column object, used for maxLength and defaultValue</param>
/// <param name="isKey">true if this property is part of the key for the entity</param>
/// <param name="isVersion">true if this property contains the version of the entity (for a concurrency strategy)</param>
/// <returns></returns>
private Dictionary<string, object> MakeDataProperty(string propName, string typeName, bool isNullable, Column col, bool isKey, bool isVersion)
{
string newType;
typeName = (BreezeTypeMap.TryGetValue(typeName, out newType)) ? newType : typeName;
var dmap = new Dictionary<string, object>();
dmap.Add("nameOnServer", propName);
dmap.Add("dataType", typeName);
dmap.Add("isNullable", isNullable);
if (col != null && col.DefaultValue != null)
{
dmap.Add("defaultValue", col.DefaultValue);
}
if (isKey)
{
dmap.Add("isPartOfKey", true);
}
if (isVersion)
{
dmap.Add("concurrencyMode", "Fixed");
}
var validators = new List<Dictionary<string, string>>();
if (!isNullable)
{
validators.Add(new Dictionary<string, string>() {
{"name", "required" },
});
}
if (col != null && col.IsLengthDefined())
{
dmap.Add("maxLength", col.Length);
validators.Add(new Dictionary<string, string>() {
{"maxLength", col.Length.ToString() },
{"name", "maxLength" }
});
}
string validationType;
if (ValidationTypeMap.TryGetValue(typeName, out validationType))
{
validators.Add(new Dictionary<string, string>() {
{"name", validationType },
});
}
if (validators.Any())
dmap.Add("validators", validators);
return dmap;
}