本文整理汇总了C#中Relation类的典型用法代码示例。如果您正苦于以下问题:C# Relation类的具体用法?C# Relation怎么用?C# Relation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Relation类属于命名空间,在下文中一共展示了Relation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplyRememberToDeleteTemplate
private void ApplyRememberToDeleteTemplate(Relation rel, RelationEnd relEnd)
{
if (rel.GetOtherEnd(relEnd).Multiplicity == Multiplicity.ZeroOrMore)
{
if (relEnd.Navigator != null)
{
var prop = relEnd.Navigator;
this.WriteObjects(" // ", rel.GetAssociationName(), " ZeroOrMore\r\n");
this.WriteObjects(" foreach(NHibernatePersistenceObject x in ", prop.Name, ") {\r\n");
this.WriteObjects(" x.ParentsToDelete.Add(this);\r\n");
this.WriteObjects(" ChildrenToDelete.Add(x);\r\n");
this.WriteObjects(" }\r\n");
}
else
{
this.WriteObjects(" // should fetch && remember parent for ", relEnd.Parent.GetRelationClassName(), "\r\n");
}
}
else
{
if (relEnd.Navigator != null)
{
var prop = relEnd.Navigator;
this.WriteObjects(" // ", rel.GetAssociationName(), "\r\n");
this.WriteObjects(" if (", prop.Name, " != null) {\r\n");
this.WriteObjects(" ((NHibernatePersistenceObject)", prop.Name, ").ChildrenToDelete.Add(this);\r\n");
this.WriteObjects(" ParentsToDelete.Add((NHibernatePersistenceObject)", prop.Name, ");\r\n");
this.WriteObjects(" }\r\n");
}
else
{
this.WriteObjects(" // should fetch && remember children for ", relEnd.Parent.GetRelationClassName(), "\r\n");
}
}
}
开发者ID:jrgcubano,项目名称:zetbox,代码行数:35,代码来源:DefaultMethods.cs
示例2: GetRelationType
public static void GetRelationType(Relation rel, MethodReturnEventArgs<RelationType> e)
{
if (rel == null)
{
throw new ArgumentNullException("rel");
}
if (rel.A == null)
{
throw new ArgumentNullException("rel", "rel.A is null");
}
if (rel.B == null)
{
throw new ArgumentNullException("rel", "rel.B is null");
}
if ((rel.A.Multiplicity.UpperBound() == 1 && rel.B.Multiplicity.UpperBound() > 1)
|| (rel.A.Multiplicity.UpperBound() > 1 && rel.B.Multiplicity.UpperBound() == 1))
{
e.Result = RelationType.one_n;
}
else if (rel.A.Multiplicity.UpperBound() > 1 && rel.B.Multiplicity.UpperBound() > 1)
{
e.Result = RelationType.n_m;
}
else if (rel.A.Multiplicity.UpperBound() == 1 && rel.B.Multiplicity.UpperBound() == 1)
{
e.Result = RelationType.one_one;
}
else
{
throw new InvalidOperationException(String.Format("Unable to find out RelationType: {0}:{1}", rel.A.Multiplicity, rel.B.Multiplicity));
}
}
开发者ID:jrgcubano,项目名称:zetbox,代码行数:33,代码来源:RelationActions.cs
示例3: defineRelation
public Relation defineRelation(string name, Types element_types)
{
if (null == name) name = ".R"+m_code.relations.Count;
Relation r = new Relation(name, element_types);
m_code.relations.Add(r);
return r;
}
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:7,代码来源:FlatBuilder.cs
示例4: ApplyIndexPropertyTemplate
protected virtual void ApplyIndexPropertyTemplate(Relation rel, RelationEndRole endRole)
{
if (rel.NeedsPositionStorage(endRole))
{
// provided by ObjectReferencePropertyTemplate
string posBackingStore = "_" + endRole + Zetbox.API.Helper.PositionSuffix;
// is serialized by the ObjectReferenceProperty
//this.MembersToSerialize.Add(
// Serialization.SerializerType.All,
// relEnd.Type.Module.Namespace,
// endRole + Zetbox.API.Helper.PositionSuffix,
// posBackingStore);
this.WriteObjects(" public int? ", endRole, "Index { get { return ",
posBackingStore, "; } set { ",
posBackingStore, " = value; } }");
this.WriteLine();
}
else if (IsOrdered())
{
this.WriteLine("/// <summary>ignored implementation for INewListEntry</summary>");
this.WriteObjects("public int? ", endRole, "Index { get { return null; } set { } }");
}
}
开发者ID:jrgcubano,项目名称:zetbox,代码行数:25,代码来源:RelationEntry.Properties.cs
示例5: FxnTypeToRelation
public Relation FxnTypeToRelation(CatFxnType ft)
{
Vector cons = TypeVectorToConstraintVector(ft.GetCons());
Vector prod = TypeVectorToConstraintVector(ft.GetProd());
Relation r = new Relation(cons, prod);
return r;
}
开发者ID:catb0t,项目名称:cat-language,代码行数:7,代码来源:CatTypeReconstructor.cs
示例6: ParseElements
protected override object ParseElements(XmlDocument xml)
{
List<Relation> relations = new List<Relation>();
Relation rel;
foreach (XmlNode node in xml.DocumentElement.ChildNodes)
{
rel = new Relation(node.Name);
foreach (XmlNode auxNode in node.ChildNodes)
{
if (auxNode.Name.Equals("Subject"))
{
rel.Subject = auxNode.InnerText;
}
else if (auxNode.Name.Equals("Target"))
{
rel.Target = auxNode.InnerText;
}
else if (auxNode.Name.Equals("Value"))
{
rel.Value = Convert.ToSingle(auxNode.InnerText, CultureInfo.InvariantCulture);
}
}
relations.Add(rel);
}
return relations;
}
开发者ID:JvJ,项目名称:Fatima,代码行数:30,代码来源:RelationsParser.cs
示例7: AddRelation
///// <summary>
/////
///// </summary>
///// <returns></returns>
//public override IEnumerable<Way> GetWays()
//{
// return _ways.Values;
//}
/// <summary>
///
/// </summary>
/// <param name="relation"></param>
public override void AddRelation(Relation relation)
{
if (relation == null) throw new ArgumentNullException("relation");
if (relation.Id == null) throw new Exception("relation.Id is null");
_relations[relation.Id.Value] = relation;
}
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:19,代码来源:OsmDataCacheMemory.cs
示例8: AddRelation
///// <summary>
/////
///// </summary>
///// <returns></returns>
//public override IEnumerable<Way> GetWays()
//{
// return _ways.Values;
//}
/// <summary>
///
/// </summary>
/// <param name="relation"></param>
public override void AddRelation(Relation relation)
{
if (relation == null) throw new ArgumentNullException("relation");
if (relation.Id == null) throw new Exception("relation.Id is null");
this.Store(relation);
}
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:19,代码来源:OsmDataCacheDisk.cs
示例9: Digraph
public Digraph(SymbolsGen s,Relation r,Func f1,Func f2,AddToFunc d)
{
sg=s; R=r; F1=f1; F2=f2; DF2=d;
N = new int[sg.m_trans];
for (int j=0;j<sg.m_trans;j++)
N[j]=0;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:pg.cs
示例10: AddRelation
/// <summary>
/// Processes the given relation.
/// </summary>
/// <param name="relation"></param>
public override void AddRelation(Relation relation)
{
if (relation.Tags != null)
{
_tagsIndex.Add(relation.Tags);
}
}
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:11,代码来源:OsmStreamTargetTags.cs
示例11: 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);
}
开发者ID:jrgcubano,项目名称:zetbox,代码行数:31,代码来源:CollectionEntryListProperty.cs
示例12: IsMyGame
public static bool IsMyGame(Relation relation)
{
return relation ==
Relation.IamPlayingAndMyMove
|| relation ==
Relation.IamPlayingAndMyOppsMove;
}
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:7,代码来源:ObservingGamePage.cs
示例13: RelationDebugTemplate
public RelationDebugTemplate(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Relation rel)
: base(_host)
{
this.ctx = ctx;
this.rel = rel;
}
开发者ID:daszat,项目名称:zetbox,代码行数:7,代码来源:RelationDebugTemplate.Designer.cs
示例14: MoveNode
internal static void MoveNode(int nodeId, int? oldParentId, int? newParentId)
{
using (CompAgriConnection ctx = new CompAgriConnection())
{
var relation = ctx.Relations.Where(o => o.Relation_Parent_Term_Id == oldParentId && o.Relation_Child_Term_Id == nodeId)
.FirstOrDefault();
if (relation != null)
{
relation.Relation_Parent_Term_Id = newParentId;
}
else
{
relation = new Relation
{
Relation_Child_Term_Id = nodeId,
Relation_Parent_Term_Id = newParentId
};
ctx.Relations.Add(relation);
}
ctx.SaveChanges();
}
}
开发者ID:keyurptl,项目名称:CompAgri,代码行数:25,代码来源:DataHelper.cs
示例15: TryWriteContentRelation
private bool TryWriteContentRelation(Relation<ContentItem> relation)
{
if (relation == null)
return false;
writer.Write(relation.ID);
return true;
}
开发者ID:rickyinnz,项目名称:n2cms,代码行数:7,代码来源:JsonWriter.cs
示例16: SQLSelectBusinessObjectByForeignKeyTemplate
public SQLSelectBusinessObjectByForeignKeyTemplate(ModelRoot model, Relation currentRelation, Table realTable)
{
_model = model;
_currentRelation = currentRelation;
_childTable = (Table)_currentRelation.ChildTableRef.Object;
if (realTable.IsInheritedFrom(_childTable)) _childTable = realTable;
_parentTable = (Table)_currentRelation.ParentTableRef.Object;
}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:8,代码来源:SQLSelectBusinessObjectByForeignKeyTemplate.cs
示例17: RelationViewModel
public RelationViewModel(
IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent,
Relation rel)
: base(appCtx, dataCtx, parent, rel)
{
_relation = rel;
_relation.PropertyChanged += (sender, args) => OnPropertyChanged(args.PropertyName);
}
开发者ID:jrgcubano,项目名称:zetbox,代码行数:8,代码来源:RelationViewModel.cs
示例18: Condition
public Condition(string firstVar, string secondVar, Relation goal)
{
FirstVariable = firstVar;
SecondVariable = secondVar;
FirstVariableModifier = 1.0;
SecondVariableModifier = 1.0;
Goal = goal;
}
开发者ID:alyons,项目名称:AI-Shell--C--,代码行数:8,代码来源:Condition.cs
示例19: Association
public Association(Relation relation, string member, string sourceKey, string referenceKey, bool viewOnly)
{
Relationship = relation;
m_sourceMember = member;
m_sourceKey = sourceKey;
m_referenceKey = referenceKey;
ViewOnly = viewOnly;
}
开发者ID:rohitdaryanani,项目名称:TekSuite,代码行数:8,代码来源:Association.cs
示例20: SqlFieldNameAttribute
public SqlFieldNameAttribute(string sqlFieldName, string sqlForeignClassName, string sqlForeignKeyFieldName, Relation relation)
{
this.IsKey = false;
this.SqlFieldName = sqlFieldName;
this.SqlForeignKeyFieldName = sqlForeignKeyFieldName;
this.SqlForeignClassName = sqlForeignClassName;
this.SqlRelation = relation;
}
开发者ID:yoorke,项目名称:zrchiptuning,代码行数:8,代码来源:SqlFieldNameAttribute.cs
注:本文中的Relation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论