本文整理汇总了C#中System.Guid类的典型用法代码示例。如果您正苦于以下问题:C# Guid类的具体用法?C# Guid怎么用?C# Guid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Guid类属于System命名空间,在下文中一共展示了Guid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReplicationCursor
internal ReplicationCursor(DirectoryServer server, string partition, Guid guid, long filter)
{
this.partition = partition;
this.invocationID = guid;
this.USN = filter;
this.server = server;
}
示例2: IsProfileAllreadyExist
public bool IsProfileAllreadyExist(Guid UserId, string WPUserId)
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
//After Session creation, start Transaction.
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
//Proceed action, to Check if FacebookUser is Exist in database or not by UserId and FbuserId.
// And Set the reuired paremeters to find the specific values.
List<Domain.Socioboard.Domain.WordpressAccount> alst = session.CreateQuery("from WordpressAccount where UserId = :userid and WpUserId = :WpUserId")
.SetParameter("userid", UserId)
.SetParameter("WpUserId", WPUserId)
.List<Domain.Socioboard.Domain.WordpressAccount>()
.ToList<Domain.Socioboard.Domain.WordpressAccount>();
if (alst.Count == 0 || alst == null)
return false;
else
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return true;
}
}//End Transaction
}//End session
}
示例3: GetWordpressAccountById
public Domain.Socioboard.Domain.WordpressAccount GetWordpressAccountById(Guid id, string wpid)
{
using (NHibernate.ISession session = SessionFactory.GetNewSession())
{
//After Session creation, start Transaction.
using (NHibernate.ITransaction transaction = session.BeginTransaction())
{
try
{
//Proceed action, to Check if FacebookUser is Exist in database or not by UserId and FbuserId.
// And Set the reuired paremeters to find the specific values.
NHibernate.IQuery query = session.CreateQuery("from WordpressAccount where UserId = :userid and WpUserId = :WpUserId");
query.SetParameter("userid", id);
query.SetParameter("WpUserId", wpid);
return (Domain.Socioboard.Domain.WordpressAccount)query.UniqueResult();
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
return null;
}
}//End Transaction
}//End session
}
示例4: TaskEventArgs
public TaskEventArgs(Guid instanceId, string id, string assignee, string text)
:base(instanceId)
{
this.idValue = id;
this.assigneeValue = assignee;
this.textValue = text;
}
示例5: GetDraft
/// <summary>
/// Gets the draft data for the media entity with the given id.
/// </summary>
/// <param name="id">The id</param>
/// <param name="type">The media type</param>
/// <returns>The draft media data, null if the data wasn't found</returns>
public virtual byte[] GetDraft(Guid id, MediaType type = MediaType.Media) {
var path = GetPath(id, true, type);
if (File.Exists(path))
return File.ReadAllBytes(path);
return null;
}
示例6: CreateOpf
/// <summary>
/// Generates the manifest and metadata information file used by the .epub reader
/// (content.opf). For more information, refer to <see cref="http://www.idpf.org/doc_library/epub/OPF_2.0.1_draft.htm#Section2.0"/>
/// </summary>
/// <param name="projInfo">Project information</param>
/// <param name="contentFolder">Content folder (.../OEBPS)</param>
/// <param name="bookId">Unique identifier for the book we're generating.</param>
public void CreateOpf(PublicationInformation projInfo, string contentFolder, Guid bookId)
{
XmlWriter opf = XmlWriter.Create(Common.PathCombine(contentFolder, "content.opf"));
opf.WriteStartDocument();
// package name
opf.WriteStartElement("package", "http://www.idpf.org/2007/opf");
opf.WriteAttributeString("version", "2.0");
opf.WriteAttributeString("unique-identifier", "BookId");
// metadata - items defined by the Dublin Core Metadata Initiative:
Metadata(projInfo, bookId, opf);
StartManifest(opf);
if (_parent.EmbedFonts)
{
ManifestFontEmbed(opf);
}
string[] files = Directory.GetFiles(contentFolder);
ManifestContent(opf, files, "epub2");
Spine(opf, files);
Guide(projInfo, opf, files, "epub2");
opf.WriteEndElement(); // package
opf.WriteEndDocument();
opf.Close();
}
示例7: CloseById
public void CloseById(Guid id)
{
var delAllocation = _unitOfWork.OtherDispatchAllocationRepository.Get().FirstOrDefault(allocation => allocation.OtherDispatchAllocationID == id);
if (delAllocation != null) delAllocation.IsClosed = true;
_unitOfWork.OtherDispatchAllocationRepository.Add(delAllocation);
_unitOfWork.Save();
}
示例8: Click
/// <summary>
/// Initializes a new instance of the Task data contract class given its required properties.
/// </summary>
/// <param name="clickGuid">Click Guid</param>
/// <param name="facilityGuid">Facility Guid</param>
/// <param name="listingTypeGuid">Listing Type Guid</param>
/// <param name="timeStamp">Time Stamp</param>
public Click(Guid clickGuid, Guid facilityGuid, Guid listingTypeGuid, DateTime timeStamp)
{
_clickGuid = clickGuid;
_facilityGuid = facilityGuid;
_listingTypeGuid = listingTypeGuid;
_timeStamp = timeStamp;
}
示例9: Article
public ActionResult Article(Guid id)
{
foreach (News item in newsManagement.news)
if (item.Id == id)
return View(item);
return Redirect("/error");
}
示例10: EnsureDocumentEtagMatchInTransaction
private void EnsureDocumentEtagMatchInTransaction(string key, Guid? etag)
{
Api.JetSetCurrentIndex(session, DocumentsModifiedByTransactions, "by_key");
Api.MakeKey(session, DocumentsModifiedByTransactions, key, Encoding.Unicode, MakeKeyGrbit.NewKey);
Guid existingEtag;
if (Api.TrySeek(session, DocumentsModifiedByTransactions, SeekGrbit.SeekEQ))
{
if (Api.RetrieveColumnAsBoolean(session, DocumentsModifiedByTransactions, tableColumnsCache.DocumentsModifiedByTransactionsColumns["delete_document"]) == true)
return; // we ignore etags on deleted documents
existingEtag = Api.RetrieveColumn(session, DocumentsModifiedByTransactions, tableColumnsCache.DocumentsModifiedByTransactionsColumns["etag"]).TransfromToGuidWithProperSorting();
}
else
{
existingEtag = Api.RetrieveColumn(session, Documents, tableColumnsCache.DocumentsColumns["etag"]).TransfromToGuidWithProperSorting();
}
if (existingEtag != etag && etag != null)
{
throw new ConcurrencyException("PUT attempted on document '" + key +
"' using a non current etag")
{
ActualETag = etag.Value,
ExpectedETag = existingEtag
};
}
}
示例11: Add
public static int Add(
Guid pollGuid,
Guid siteGuid,
String question,
bool anonymousVoting,
bool allowViewingResultsBeforeVoting,
bool showOrderNumbers,
bool showResultsWhenDeactivated,
bool active,
DateTime activeFrom,
DateTime activeTo)
{
SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Polls_Insert", 10);
sph.DefineSqlParameter("@PollGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, pollGuid);
sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid);
sph.DefineSqlParameter("@Question", SqlDbType.NVarChar, 255, ParameterDirection.Input, question);
sph.DefineSqlParameter("@AnonymousVoting", SqlDbType.Bit, ParameterDirection.Input, anonymousVoting);
sph.DefineSqlParameter("@AllowViewingResultsBeforeVoting", SqlDbType.Bit, ParameterDirection.Input, allowViewingResultsBeforeVoting);
sph.DefineSqlParameter("@ShowOrderNumbers", SqlDbType.Bit, ParameterDirection.Input, showOrderNumbers);
sph.DefineSqlParameter("@ShowResultsWhenDeactivated", SqlDbType.Bit, ParameterDirection.Input, showResultsWhenDeactivated);
sph.DefineSqlParameter("@Active", SqlDbType.Bit, ParameterDirection.Input, active);
sph.DefineSqlParameter("@ActiveFrom", SqlDbType.DateTime, ParameterDirection.Input, activeFrom);
sph.DefineSqlParameter("@ActiveTo", SqlDbType.DateTime, ParameterDirection.Input, activeTo);
int rowsAffected = sph.ExecuteNonQuery();
return rowsAffected;
}
示例12: Delete
public static bool Delete(Guid pollGuid)
{
SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Polls_Delete", 1);
sph.DefineSqlParameter("@PollGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, pollGuid);
int rowsAffected = sph.ExecuteNonQuery();
return (rowsAffected > 0);
}
示例13: Get
public User Get(Guid id)
{
using (var db = base.NewDB())
{
return db.Users.Get(id);
}
}
示例14: HasValidSignature
public static bool HasValidSignature(string fileName) {
try {
if (_isValidCache.Contains(fileName)) {
return true;
}
var wtd = new WinTrustData(fileName);
var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2);
WinVerifyTrustResult result = WinTrust.WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);
bool ret = (result == WinVerifyTrustResult.Success);
if (ret) {
_isValidCache.Add(fileName);
}
#if COAPP_ENGINE_CORE
var response = Event<GetResponseInterface>.RaiseFirst();
if( response != null ) {
response.SignatureValidation(fileName, ret, ret ? Verifier.GetPublisherInformation(fileName)["PublisherName"] : null);
}
#endif
return ret;
} catch (Exception) {
return false;
}
}
示例15: ChangeName
public ActionResult ChangeName(Guid id, string name, int version)
{
var command = new RenameInventoryItem(id, name, version);
_bus.Send(command);
return RedirectToAction("Index");
}