本文整理汇总了C#中Relation.GetRelationClassName方法的典型用法代码示例。如果您正苦于以下问题:C# Relation.GetRelationClassName方法的具体用法?C# Relation.GetRelationClassName怎么用?C# Relation.GetRelationClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relation
的用法示例。
在下文中一共展示了Relation.GetRelationClassName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Call
public static void Call(Arebis.CodeGeneration.IGenerationHost host,
IZetboxContext ctx,
Templates.Serialization.SerializationMembersList serializationList,
Relation rel, RelationEndRole endRole, string backingCollectionType)
{
if (host == null) { throw new ArgumentNullException("host"); }
if (rel == null) { throw new ArgumentNullException("rel"); }
RelationEnd relEnd = rel.GetEndFromRole(endRole);
RelationEnd otherEnd = rel.GetOtherEnd(relEnd);
string name = relEnd.Navigator.Name;
string exposedCollectionInterface = rel.NeedsPositionStorage(otherEnd.GetRole()) ? "IList" : "ICollection";
string referencedInterface = otherEnd.Type.GetDataTypeString();
string backingName = "_" + name;
string aSideType = rel.A.Type.GetDataTypeString();
string bSideType = rel.B.Type.GetDataTypeString();
string entryType = rel.GetRelationFullName() + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix;
string providerCollectionType = (rel.NeedsPositionStorage(otherEnd.GetRole()) ? "IList<" : "ICollection<")
+ entryType + ">";
bool eagerLoading = relEnd.Navigator != null && relEnd.Navigator.EagerLoading;
bool serializeRelationEntries = rel.GetRelationType() == RelationType.n_m;
string entryProxyType = entryType + "." + rel.GetRelationClassName() + "Proxy";
string inverseNavigatorName = otherEnd.Navigator != null ? otherEnd.Navigator.Name : null;
Call(host, ctx, serializationList, name, exposedCollectionInterface, referencedInterface, backingName, backingCollectionType, aSideType, bSideType, entryType, providerCollectionType, rel.ExportGuid, endRole, eagerLoading, serializeRelationEntries, entryProxyType, inverseNavigatorName);
}
示例2: ApplyNMProperty
private void ApplyNMProperty(
Relation rel, RelationEnd relEnd, RelationEnd otherEnd,
ObjectReferenceProperty prop)
{
this.WriteLine(" <!-- NMProperty -->");
this.WriteLine(" <!-- rel={0} -->", rel.GetRelationClassName());
this.WriteLine(" <!-- relEnd={0} otherEnd={1} -->", relEnd.RoleName, otherEnd.RoleName);
string nameAttr = String.Format("name=\"{0}\"", prop.Name);
string tableName = rel.GetRelationTableName();
string tableAttr = String.Format("table=\"`{0}`\"", tableName);
string relationEntryClassAttr = String.Format("class=\"{0}.{1}{2}+{1}Proxy,Zetbox.Objects.NHibernateImpl\"",
rel.Module.Namespace,
rel.GetRelationClassName(),
ImplementationSuffix);
string fkThisColumnAttr = String.Format("column=\"`{0}`\"", Construct.ForeignKeyColumnName(relEnd));
//string fkOtherColumnAttr = String.Format("column=\"`{0}`\"", Construct.ForeignKeyColumnName(otherEnd));
// always map as set, the wrapper has to translate/order the elements
this.WriteObjects(" <set ", nameAttr, " ", tableAttr, " inverse=\"true\" cascade=\"all-delete-orphan\" batch-size=\"100\" ");
if (prop.EagerLoading)
{
// TODO: re-think and re-test eagerloading
//this.WriteObjects("lazy=\"false\" fetch=\"join\" ");
}
this.WriteLine(">");
this.WriteObjects(" <key ", fkThisColumnAttr, " />");
this.WriteLine();
this.WriteObjects(" <one-to-many ", relationEntryClassAttr, " />");
this.WriteLine();
this.WriteObjects(" </set>");
this.WriteLine();
}
示例3: ApplyObjectReferenceProperty
protected override void ApplyObjectReferenceProperty(Relation rel, RelationEndRole endRole, string propertyName)
{
RelationEnd relEnd = rel.GetEndFromRole(endRole);
RelationEnd otherEnd = rel.GetOtherEnd(relEnd);
// TODO: create/use ObjectReference*IMPLEMENTATION* instead (_fk* can already be made available)
string moduleNamespace = rel.Module.Namespace;
string ownInterface = moduleNamespace + "." + rel.GetRelationClassName() + ImplementationSuffix;
string name = propertyName;
string implName = propertyName + ImplementationPropertySuffix;
string eventName = "On" + name;
string fkBackingName = "_fk_" + name;
string fkGuidBackingName = "_fk_guid_" + name;
string referencedInterface = relEnd.Type.GetDataTypeString();
string referencedImplementation = referencedInterface + ImplementationSuffix;
string associationName = rel.GetAssociationName();
string targetRoleName = otherEnd.RoleName;
string positionPropertyName = rel.NeedsPositionStorage(endRole)
? name + Zetbox.API.Helper.PositionSuffix
: null;
string inverseNavigatorName = null; // do not care about inverse navigator
bool inverseNavigatorIsList = false;
bool eagerLoading = relEnd.Navigator != null && relEnd.Navigator.EagerLoading;
bool relDataTypeExportable = rel.A.Type.ImplementsIExportable() && rel.B.Type.ImplementsIExportable();
bool callGetterSetterEvents = false;
Properties.ObjectReferencePropertyTemplate.Call(Host,
ctx,
MembersToSerialize,
moduleNamespace,
ownInterface,
name,
implName,
eventName,
fkBackingName,
fkGuidBackingName,
referencedInterface,
referencedImplementation,
associationName,
targetRoleName,
positionPropertyName,
inverseNavigatorName,
inverseNavigatorIsList,
eagerLoading,
relDataTypeExportable,
callGetterSetterEvents,
false,
false);
}