• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Identity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Identity的典型用法代码示例。如果您正苦于以下问题:C# Identity类的具体用法?C# Identity怎么用?C# Identity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Identity类属于命名空间,在下文中一共展示了Identity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: GetFeedEntry

        public new Sage.Common.Syndication.FeedEntry GetFeedEntry(string id)
        {
            PostalAddressFeedEntry result;

            Account account = new Account();
            Identity identity = new Identity(account.EntityName, id);
            AccountDocument accountDocument = (AccountDocument)_entity.GetDocument(identity, _emptyToken, _context.Config);

            if ((accountDocument.LogState == LogState.Deleted)
                    || (accountDocument.addresses.documents.Count == 0))
            {
                PostalAddressFeedEntry deletedPayload = new PostalAddressFeedEntry();
                deletedPayload.UUID = GetUuid(id);
                deletedPayload.IsDeleted = true;
                return deletedPayload;
            }

            Document document = accountDocument.addresses.documents[0];

            result = (PostalAddressFeedEntry)GetTransformedPayload(document);

            string taUuid = GetTradingAccountUuid(accountDocument.Id);

            #warning no reference for trading accounts exists in the contract

            return result;
        }
开发者ID:Sage,项目名称:SData-Contracts,代码行数:27,代码来源:PostalAddressFeedEntryWrapper.cs


示例17: GetIdentiy

        private  Identity GetIdentiy()
        {
            var principal = ClaimsPrincipal.Current;

            Identity i = new Identity();
            if (principal != null && principal.Identity != null)
            {
                i.IdentityName = principal.Identity.Name;
                i.IsAuthenticated = principal.Identity.IsAuthenticated;
                i.AuthenticationType = principal.Identity.AuthenticationType;
            }
            else
            {
                i.IsAuthenticated = false;
            }

            var claims = new List<ViewClaim>(
                from c in principal.Claims
                select new ViewClaim
                {
                    Type = c.Type,
                    Value = c.Value
                });

            i.Claims = claims;

            return i;
        }
开发者ID:jonnoking,项目名称:K2Field.SmartForms.Workspace,代码行数:28,代码来源:IdentityController.cs


示例18: TestTransport

 public TestTransport(TestTransportFactory testTransportFactory, Identity identity, RoutingTable routingTable, PeerTable peerTable, InboundMessageDispatcher inboundMessageDispatcher) {
    this.testTransportFactory = testTransportFactory;
    this.identity = identity;
    this.routingTable = routingTable;
    this.peerTable = peerTable;
    this.inboundMessageDispatcher = inboundMessageDispatcher;
 }
开发者ID:the-dargon-project,项目名称:courier,代码行数:7,代码来源:TestTransport.cs


示例19: GetSetting

 public Rule GetSetting(Identity id)
 {
     var settings = from r in SettingsDataStore.Items<Setting>()
                 where r.I == id
                 select r;
     return settings.First<Setting>();
 }
开发者ID:BVNetwork,项目名称:Relations,代码行数:7,代码来源:Settings.ascx.cs


示例20: IdentityPropertyRules

		internal IdentityPropertyRules(Identity id)
		{
			SetGenderTargettingBitInfoType(id.Usr);
			SetAgeRangeTargetting(id.Usr);
			SetIsPromoterTargettingBitInfoType(id.Usr);

			SetDemographics(id.Demographics);
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:8,代码来源:IdentityPropertyRules.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IdentityObject类代码示例发布时间:2022-05-24
下一篇:
C# IdentifierTerminal类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap