本文整理汇总了C#中Identity类的典型用法代码示例。如果您正苦于以下问题:C# Identity类的具体用法?C# Identity怎么用?C# Identity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identity类属于命名空间,在下文中一共展示了Identity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
ctx = GetContext();
var principalResolver = scope.Resolve<IPrincipalResolver>();
var currentPrincipal = principalResolver.GetCurrent();
Assert.That(currentPrincipal, Is.Not.Null, "No current identity found - try syncidentities or setup the current identity correctly");
identity1 = ctx.Find<Identity>(currentPrincipal.ID);
identity2 = ctx.GetQuery<Identity>().Where(i => i.ID != identity1.ID).First();
parent = ctx.Create<SecurityTestParent>();
parent.Name = "MyParent";
child1 = ctx.Create<SecurityTestChild>();
child1.Name = "Child1";
child1.Identity = identity1;
child1.Parent = parent;
child2 = ctx.Create<SecurityTestChild>();
child2.Name = "Child2";
child2.Identity = identity2;
child2.Parent = parent;
ctx.SubmitChanges();
}
示例2: Element
public Element(IElementSet set, int nElement)
{
Identity = new Identity(set.GetElementId(nElement));
int nV = set.GetVertexCount(nElement);
int nF = set.GetFaceCount(nElement);
X = new double[nV];
Y = new double[nV];
if (set.HasZ)
Z = new double[nV];
if (set.HasM)
M = new double[nV];
for (int n = 0; n < nV; ++n)
{
X[n] = set.GetVertexXCoordinate(nElement, n);
Y[n] = set.GetVertexYCoordinate(nElement, n);
if (set.HasZ)
Z[n] = set.GetVertexZCoordinate(nElement, n);
if (set.HasM)
M[n] = set.GetVertexMCoordinate(nElement, n);
}
if (nF > 0)
{
Faces = new int[nF][];
for (int n = 0; n < nF; ++n)
Faces[n] = set.GetFaceVertexIndices(nElement, n);
}
}
示例3: DownloadImage
public FileInfo DownloadImage(string imageId, string outputPath, Identity identity)
{
RequestManager requestManager = new RequestManager(identity);
var uri = string.Format("/v2/images/{0}/file", imageId);
FileInfo result = requestManager.Download(imageId, outputPath,"glance");
return result;
}
示例4: SqrlClientFacts
static SqrlClientFacts()
{
var mock = new Mock<IIdentityStorageProvider>();
mock.Setup(x => x.Load(Name)).Returns(Data);
Identity.StorageProvider = mock.Object;
Identity = Identity.Open(Name, Password);
}
示例5: GangModel
public GangModel(Identity identity)
{
Gang = identity.Gang;
Id = identity.Id;
Valid = true;
Identified = identity.Registered;
}
示例6: SetPasswordUI
public static void SetPasswordUI(Identity obj)
{
_vmf.CreateDialog(obj.Context, Strings.SetPasswordDlgTitle)
.AddPassword("pwd", Strings.Password)
.AddPassword("repeat", Strings.RepeatPassword)
.Show(values =>
{
var pwd = (string)values["pwd"];
var repeat = (string)values["repeat"];
if (string.IsNullOrEmpty(pwd))
{
_vmf.ShowMessage(Strings.PasswordEmpty, Strings.SetPasswordDlgTitle);
return;
}
if(pwd != repeat)
{
_vmf.ShowMessage(Strings.PasswordDoesNotMatch, Strings.SetPasswordDlgTitle);
return;
}
obj.SetPassword(pwd);
});
}
示例7: CreateQueryDocument
public IMongoQuery CreateQueryDocument(Identity topicId)
{
return Query.And(
Query.NE("Callback", BsonNull.Value),
Query.EQ("TargetKind", (int)TargetKind.Topic),
Query.EQ("TargetId", topicId.ToBson()));
}
示例8: CreateInstance
public Instance CreateInstance(string instanceName, string imageId, string keypairName, string flavorId, Identity identity)
{
RequestManager requestManager = new RequestManager(identity);
var uri = string.Format("/servers");
var bodyObject = new InstanceRequestBodyWrapper()
{
server = new InstanceRequestBody()
{
name = instanceName,
imageRef = imageId,
key_name = keypairName,
flavorRef = flavorId,
}
};
System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
string body = oSerializer.Serialize(bodyObject);
JObject response = requestManager.Post(uri, body, "nova");
if (response != null)
{
var tempinstance = response["server"];
var instance = new Instance()
{
Id = tempinstance["id"].ToString(),
};
return instance;
}
return null;
}
示例9: TestToString
public void TestToString()
{
Identity<uint> three = new Identity<uint>(typeof(Person), 3);
Assert.AreEqual("[CSF.Patterns.DDD.Mocks.Entities.Person: 3]",
three.ToString(),
"Correct string representation");
}
示例10: Equals
public bool Equals(Identity id)
{
var tmcId = id as TmcClientIdentity;
return tmcId != null
&& this.AppKey == tmcId.AppKey
&& this.GroupName == tmcId.GroupName;
}
示例11: GetTopics
public IEnumerable<Topic> GetTopics(Identity groupId, int? skip = null, int? limit = null)
{
var cursor = topicsCollection.Find(QueryGetByGroup(groupId));
if (skip.HasValue) cursor.SetSkip(skip.Value);
if (limit.HasValue) cursor.SetLimit(limit.Value);
return cursor;
}
示例12: DeleteData
public void DeleteData()
{
var ctx = scope.Resolve<IZetboxServerContext>();
ctx.GetQuery<Task>().ForEach(obj => ctx.Delete(obj));
ctx.SubmitChanges();
ctx = scope.Resolve<IZetboxServerContext>();
ctx.GetQuery<Projekt>().ForEach(obj => { obj.Mitarbeiter.Clear(); ctx.Delete(obj); });
ctx.SubmitChanges();
ctx = scope.Resolve<IZetboxServerContext>();
ctx.GetQuery<Mitarbeiter>().ForEach(obj => ctx.Delete(obj));
ctx.GetQuery<Kunde>().ForEach(obj => ctx.Delete(obj));
ctx.SubmitChanges();
ctx = scope.Resolve<IZetboxServerContext>();
if (identity1 != null) { var id = ctx.Find<Identity>(identity1.ID); id.Groups.Clear(); ctx.Delete(id); }
if (identity2 != null) { var id = ctx.Find<Identity>(identity2.ID); id.Groups.Clear(); ctx.Delete(id); }
if (identity3_low != null) { var id = ctx.Find<Identity>(identity3_low.ID); id.Groups.Clear(); ctx.Delete(id); }
identity1 = null;
identity2= null;
identity3_low = null;
ctx.SubmitChanges();
}
示例13: CastToGuid
public void CastToGuid()
{
var identity = new Identity(new Guid(IdentityTest.Guid1));
Guid guid = identity;
Assert.AreEqual(identity, guid);
}
示例14: Execute
public Feed Execute(Identity topicId)
{
Feed workingFeed;
lock (lck)
{
workingFeed = feeds.Find(Query.EQ("TopicId", topicId.ToBson()))
.SetSortOrder(SortBy.Descending("Updated"))
.SetLimit(1).FirstOrDefault();
if (workingFeed == null || workingFeed.Entries.Count >= 10)
{
var newFeed = new Feed
{
TopicId = topicId,
};
if(workingFeed != null)
{
newFeed.PreviousFeed = workingFeed.Id;
feeds.Insert(newFeed);
workingFeed.NextFeed = newFeed.Id;
feeds.Save(workingFeed);
}else
{
feeds.Insert(newFeed);
}
workingFeed = newFeed;
}
}
return workingFeed;
}
示例15: EqualityBetweenIdentityAndGuid
public void EqualityBetweenIdentityAndGuid()
{
var identity = new Identity(new Guid(IdentityTest.Guid1));
var guid = new Guid(IdentityTest.Guid1);
Assert.AreEqual(identity, guid);
}