本文整理汇总了C#中FactMemento.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# FactMemento.GetHashCode方法的具体用法?C# FactMemento.GetHashCode怎么用?C# FactMemento.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactMemento
的用法示例。
在下文中一共展示了FactMemento.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertFact
public FactID InsertFact(FactMemento fact, int typeId)
{
_session.Command.CommandText = "INSERT Fact (FKTypeID, Data, Hashcode) VALUES (@TypeID, @Data, @Hashcode)";
AddParameter("@TypeID", typeId);
AddParameter("@Data", fact.Data);
AddParameter("@Hashcode", fact.GetHashCode());
_session.Command.ExecuteNonQuery();
_session.Command.Parameters.Clear();
_session.Command.CommandText = "SELECT @@IDENTITY";
decimal result = (decimal)_session.Command.ExecuteScalar();
_session.Command.Parameters.Clear();
return new FactID { key = (Int64)result };
}
示例2: GetEqualFactsByHashCode
public List<IdentifiedFactMemento> GetEqualFactsByHashCode(FactMemento memento, bool readCommitted, int typeId)
{
_session.Command.CommandText = HEAD_SELECT +
(readCommitted ? "" : "WITH (NOLOCK) ") +
"WHERE f.FKTypeID = @TypeID AND f.Hashcode = @Hashcode " +
TAIL_JOIN +
"ORDER BY ff.FactID, p.PredecessorID";
AddParameter("@TypeID", typeId);
AddParameter("@Hashcode", memento.GetHashCode());
using (var loader = new Loader(_session.Command.ExecuteReader()))
{
_session.Command.Parameters.Clear();
return loader.LoadMementos()
.Where(im => im.Memento.Equals(memento))
.ToList();
}
}