当前位置: 首页>>代码示例>>C#>>正文


C# Identity类代码示例

本文整理汇总了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();
        }
开发者ID:daszat,项目名称:zetbox,代码行数:29,代码来源:AbstractSecurityTest.cs

示例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);
            }
        }
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:34,代码来源:Element.cs

示例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;
 }
开发者ID:cloudbase,项目名称:dotnet-openstack-api,代码行数:7,代码来源:ImageManager.cs

示例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);
 }
开发者ID:DerekAlfonso,项目名称:sqrl-net,代码行数:7,代码来源:SqrlClientFacts.cs

示例5: GangModel

 public GangModel(Identity identity)
 {
     Gang = identity.Gang;
     Id = identity.Id;
     Valid = true;
     Identified = identity.Registered;
 }
开发者ID:Rawne,项目名称:laststand,代码行数:7,代码来源:GangModel.cs

示例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);
                });
        }
开发者ID:daszat,项目名称:zetbox,代码行数:25,代码来源:IdentityActions.cs

示例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()));
 }
开发者ID:jasondentler,项目名称:Hermes,代码行数:7,代码来源:SubscriptionsByTopic.cs

示例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;
        }
开发者ID:cloudbase,项目名称:dotnet-openstack-api,代码行数:31,代码来源:InstanceManager.cs

示例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");
 }
开发者ID:csf-dev,项目名称:Patterns.DDD,代码行数:7,代码来源:TestIdentity.cs

示例10: Equals

 public bool Equals(Identity id)
 {
     var tmcId = id as TmcClientIdentity;
     return tmcId != null
         && this.AppKey == tmcId.AppKey
         && this.GroupName == tmcId.GroupName;
 }
开发者ID:ashou1986,项目名称:TopSDK,代码行数:7,代码来源:TmcIdentity.cs

示例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;
 }
开发者ID:ashic,项目名称:Hermes,代码行数:7,代码来源:TopicsByGroup.cs

示例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();
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:25,代码来源:SecurityDataFixture.cs

示例13: CastToGuid

        public void CastToGuid()
        {
            var identity = new Identity(new Guid(IdentityTest.Guid1));
            Guid guid = identity;

            Assert.AreEqual(identity, guid);
        }
开发者ID:TeleginS,项目名称:MonoKit,代码行数:7,代码来源:IdentityTest.cs

示例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;
        }
开发者ID:ashic,项目名称:Hermes,代码行数:31,代码来源:GetWorkingFeedForTopic.cs

示例15: EqualityBetweenIdentityAndGuid

        public void EqualityBetweenIdentityAndGuid()
        {
            var identity = new Identity(new Guid(IdentityTest.Guid1));
            var guid = new Guid(IdentityTest.Guid1);

            Assert.AreEqual(identity, guid);
        }
开发者ID:TeleginS,项目名称:MonoKit,代码行数:7,代码来源:IdentityTest.cs


注:本文中的Identity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。