本文整理汇总了C#中NHibernate.Mapping.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# List.Count方法的具体用法?C# List.Count怎么用?C# List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Mapping.List
的用法示例。
在下文中一共展示了List.Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddComponent
/// <summary>
/// Adds a complex type definition
/// </summary>
/// <param name="compType">The complex type</param>
/// <param name="propColumns">The columns which the complex type spans. These are used to get the length and defaultValues</param>
/// <returns>The class name and namespace in the form "Location:#Breeze.Nhibernate.NorthwindIBModel"</returns>
string AddComponent(ComponentType compType, List<ISelectable> propColumns)
{
var type = compType.ReturnedClass;
// "Location:#Breeze.Nhibernate.NorthwindIBModel"
var classKey = type.Name + ":#" + type.Namespace;
if (_typeNames.Contains(classKey))
{
// Only add a complex type definition once.
return classKey;
}
var cmap = new Dictionary<string, object>();
_typeList.Insert(0, cmap); // insert, because complex type definitions must come before they are referenced
_typeNames.Add(classKey);
cmap.Add("shortName", type.Name);
cmap.Add("namespace", type.Namespace);
cmap.Add("isComplexType", true);
var dataList = new List<Dictionary<string, object>>();
cmap.Add("dataProperties", dataList);
var propNames = compType.PropertyNames;
var propTypes = compType.Subtypes;
var propNull = compType.PropertyNullability;
var colIndex = 0;
for (int i = 0; i < propNames.Length; i++)
{
var propType = propTypes[i];
var propName = propNames[i];
if (propType.IsComponentType)
{
// complex type
var compType2 = (ComponentType)propType;
var span = compType2.GetColumnSpan((IMapping) _sessionFactory);
var subColumns = propColumns.Skip(colIndex).Take(span).ToList();
var complexTypeName = AddComponent(compType2, subColumns);
var compMap = new Dictionary<string, object>();
compMap.Add("nameOnServer", propName);
compMap.Add("complexTypeName", complexTypeName);
compMap.Add("isNullable", propNull[i]);
dataList.Add(compMap);
colIndex += span;
}
else
{
// data property
var col = propColumns.Count() == 1 ? propColumns[colIndex] as Column : null;
var dmap = MakeDataProperty(propName, propType.Name, propNull[i], col, false, false);
dataList.Add(dmap);
colIndex++;
}
}
return classKey;
}