本文整理汇总了C#中ISession.Create方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.Create方法的具体用法?C# ISession.Create怎么用?C# ISession.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISession
的用法示例。
在下文中一共展示了ISession.Create方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static GT32UnitLT32Composite Create(ISession session)
{
return (GT32UnitLT32Composite)session.Create(Meta.ObjectType);
}
示例2: Create
public static Sandbox Create(ISession session)
{
return (Sandbox)session.Create(Meta.ObjectType);
}
示例3: Create
public static ClassWithoutUnitRoles Create(ISession session)
{
return (ClassWithoutUnitRoles)session.Create(Meta.ObjectType);
}
示例4: Create
public static Company[] Create(ISession session, int count)
{
return (Company[])session.Create(Meta.ObjectType, count);
}
示例5: Create
public static SingleUnit[] Create(ISession session, int count)
{
return (SingleUnit[])session.Create(Meta.ObjectType, count);
}
示例6: Create
public static LT32[] Create(ISession session, int count)
{
return (LT32[])session.Create(Meta.ObjectType, count);
}
示例7: Create
public static C1 Create(ISession session)
{
return (C1)session.Create(Meta.ObjectType);
}
示例8: Create
public static User Create(ISession session)
{
return (User)session.Create(Meta.ObjectType);
}
示例9: CreateRolesWithSameClass
private IObject[] CreateRolesWithSameClass(ISession session, RelationType relationType, ObjectType roleClass)
{
IObject[] allRoles = this.CreateArray(relationType.RoleType.ObjectType, this.GetRoleCount());
for (int i = 0; i < allRoles.Length; i++)
{
allRoles[i] = session.Create(roleClass);
}
return allRoles;
}
示例10: CreateRolesWithDifferentClass
private IObject[] CreateRolesWithDifferentClass(ISession session, RelationType relationType)
{
IObject[] allRoles = this.CreateArray(relationType.RoleType.ObjectType, this.GetRoleCount());
var concreteClasses = relationType.RoleType.ObjectType.ConcreteClasses;
for (int i = 0; i < allRoles.Length; i++)
{
int classIndex = i % concreteClasses.Length;
ObjectType roleType = concreteClasses[classIndex];
allRoles[i] = session.Create(roleType);
}
return allRoles;
}
示例11: Create
public static Person Create(ISession session)
{
return (Person)session.Create(Meta.ObjectType);
}
示例12: Build
public static object Build(ISession session, IObjectType objectType)
{
if (objectType.IsUnit)
{
var unit = (Unit)objectType;
var unitTypeTag = unit.UnitTag;
switch (unitTypeTag)
{
case UnitTags.AllorsString:
return string.Empty;
case UnitTags.AllorsInteger:
return 0;
case UnitTags.AllorsDecimal:
return 0m;
case UnitTags.AllorsFloat:
return 0d;
case UnitTags.AllorsBoolean:
return false;
case UnitTags.AllorsBinary:
return new byte[0];
case UnitTags.AllorsUnique:
return Guid.NewGuid();
default:
throw new ArgumentException("Unknown Unit ObjectType: " + unitTypeTag);
}
}
Type builderType;
if (!BuilderTypeByObjectTypeId.TryGetValue(objectType, out builderType))
{
var builderTypeName = "Allors.Domain." + objectType.Name + "Builder";
builderType = Type.GetType(builderTypeName, false);
if (builderType != null)
{
BuilderTypeByObjectTypeId[objectType] = builderType;
}
}
if (builderType != null)
{
object[] parameters = { session };
var builder = (IObjectBuilder)Activator.CreateInstance(builderType, parameters);
return builder.DefaultBuild();
}
return session.Create((Class)objectType);
}