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


C# System.Entity类代码示例

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


Entity类属于System命名空间,在下文中一共展示了Entity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Program

        public Program()
        {
            m_service = new MockCrmService();

            // test data for simple fetch
            Entity de = new Entity();
            de.LogicalName = "mydynamic";
            de["prop1"] = "foo";
            Guid deID = m_service.Create( de );

            // test data for filters
            de = new Entity();
            de.LogicalName = "contact";
            de[ "address1_name" ] = "Dan";
            de[ "address1_city" ] = "Bethesda";
            Guid deID2 = m_service.Create( de );

            // data for testing links
            Guid guid = Guid.NewGuid();
            de = new Entity();
            de.LogicalName = "subject";
            de[ "subjectid" ] = guid;
            Guid deID3 = m_service.Create( de );

            de = new Entity();
            de.LogicalName = "subject";
            de[ "subjectid" ] = guid;
            de[ "title" ] = "child";
            de[ "parentsubject" ] = new EntityReference( "subject", deID3 );
            Guid deID4 = m_service.Create( de );
        }
开发者ID:modulexcite,项目名称:FakeCRM,代码行数:31,代码来源:Program.cs

示例2: ProcessEntities

        protected override void ProcessEntities(Dictionary<int, Entity> entities)
        {
            float simultaneous = Environment.ProcessorCount * 2;
            int perThread = (int)Math.Ceiling(((float)entities.Values.Count) / simultaneous);
            Entity[] ents = new Entity[entities.Values.Count];
            entities.Values.CopyTo(ents, 0);
            int num = entities.Values.Count - 1;
            List<Task> tasks = new List<Task>();

            for (int j = 0; j < simultaneous; j++)
            {
                int initial = num;
                tasks.Add(factory.StartNew(
                    () =>
                    {
                        for (int i = initial; i > initial - perThread && i >= 0; i--)
                        {
                            Process(ents[i]);
                        }
                    }
                ));
                num -= perThread;
            }
            Task.WaitAll(tasks.ToArray());
        }
开发者ID:LostCodeStudios,项目名称:GameLib,代码行数:25,代码来源:ParallelEntityProcessingSystem.cs

示例3: TestAddRemoveListenerImpl

        private void TestAddRemoveListenerImpl(Game game)
        {
            var audio = game.Audio;
            var notAddedToEntityListener = new AudioListenerComponent();
            var addedToEntityListener = new AudioListenerComponent();

            // Add a listenerComponent not present in the entity system yet and check that it is correctly added to the AudioSystem internal data structures
            Assert.DoesNotThrow(() => audio.AddListener(notAddedToEntityListener), "Adding a listener not present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem does not contains the notAddedToEntityListener.");

            // Add a listenerComponent already present in the entity system and check that it is correctly added to the AudioSystem internal data structures
            var entity = new Entity("Test");
            entity.Add(addedToEntityListener);
            throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
            //game.Entities.Add(entity);
            Assert.DoesNotThrow(() => audio.AddListener(addedToEntityListener), "Adding a listener present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem does not contains the addedToEntityListener.");

            // Add a listenerComponent already added to audio System and check that it does not crash
            Assert.DoesNotThrow(()=>audio.AddListener(addedToEntityListener), "Adding a listener already added to the audio system failed.");

            // Remove the listeners from the AudioSystem and check that they are removed from internal data structures.
            Assert.DoesNotThrow(() => audio.RemoveListener(notAddedToEntityListener), "Removing an listener not present in the entity system failed.");
            Assert.IsFalse(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem still contains the notAddedToEntityListener.");
            Assert.DoesNotThrow(() => audio.RemoveListener(addedToEntityListener), "Removing an listener present in the entity system fails");
            Assert.IsFalse(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem still contains the addedToEntityListener.");

            // Remove a listener not present in the AudioSystem anymore and check the thrown exception
            Assert.Throws<ArgumentException>(() => audio.RemoveListener(addedToEntityListener), "Removing the a non-existing listener did not throw ArgumentException.");
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:30,代码来源:TestAudioSystem.cs

示例4: KickPlayer

 // Some functions below - Might move to seperate file? (functions.cs)
 public void KickPlayer(Entity player)
 {
     player.AfterDelay(100, entity =>
     {
         Call("kick", player.Call<int>("getentitynumber"));
     });
 }
开发者ID:iConnorM,项目名称:iw5m-zombies,代码行数:8,代码来源:main.cs

示例5: GetRecords

        private PagedRecords GetRecords(
            Entity entity,
            NameValueCollection request,
            TableInfo tableInfo,
            Action<IList<BaseFilter>> filtersMutator)
        {
            var filterRecord = create_filter_record(entity, request);
            var filters = _filterFactory.BuildFilters(filterRecord).ToList();
            if (filtersMutator != null)
            {
                filtersMutator(filters);
            }
            var pagedRecords = _entitiesSource.GetRecords(
                entity,
                filters,
                tableInfo.SearchQuery,
                tableInfo.Order,
                tableInfo.OrderDirection,
                false,
                tableInfo.Page,
                tableInfo.PerPage);
            pagedRecords.Filters = filters;

            return pagedRecords;
        }
开发者ID:tassyo1,项目名称:Ilaro.Admin,代码行数:25,代码来源:RecordsService.cs

示例6: OnUpdateSystem

        private void OnUpdateSystem(ParticleEmitterComponent particleEmitterComponent)
        {
            if (dragonHead == null)
                dragonHead = EntitySystem.Entities.FirstOrDefault(x => x.Name == "English DragonPelvis");

            var desc = Description;

            if (dragonHead != null)
            {
                var dragonTransform = dragonHead.Transformation;
                if (dragonTransform != null)
                {
                    desc.TargetOld = desc.Target;
                    desc.Target = (Vector3)dragonTransform.WorldMatrix.Row4;
                }
            }

            var animationComponent = RootAnimation.GetOrCreate(AnimationComponent.Key);
            if (animationComponent != null)
            {
                desc.AnimationTime = (float)animationComponent.CurrentTime.TotalSeconds;
                // If we reset, reupload the particle buffer
                if ((animationComponent.CurrentTime.Ticks - lastTime.Ticks) < 0) 
                    particleEmitterComponent.UpdateNextBuffer = true;

                lastTime = animationComponent.CurrentTime;
            }

            Description = desc;
        }
开发者ID:cg123,项目名称:xenko,代码行数:30,代码来源:BulletParticleEmitterComponent.cs

示例7: DeleteUser

 /// <summary>
 /// 删除一个用户 业务角度来说 其实是不需要的
 /// </summary>
 /// <param name="entity">memberiship用户</param>
 /// <returns>领域处理结果</returns>
 public DomainResult DeleteUser(Entity.MemberShip.Membership entity)
 {
     if (IsExistUser(entity.Users.UserName).isSuccess)
     {
         var result = DomainResult.GetDefault();
         try
         {
             Membership.DeleteUser(entity.Users.UserName);
             using (var content = new SiteContext())
             {
                 var other = content.OtherInformations
                     .Where(r => r.Email == entity.Users.UserName).FirstOrDefault();
                 if (other != null)
                 {
                     content.OtherInformations.Remove(other);
                     content.SaveChanges();
                 }
             }
         }
         catch (Exception ex)
         {
             result.isSuccess = false;
             result.error = ex;
             result.ResultMsg = ex.Message;
         }
         return result;
     }
     else
     {
         return new DomainResult(false) { ResultMsg = "用户不存在" };
     }
 }
开发者ID:tihou,项目名称:Fx.InformationPlatform.,代码行数:37,代码来源:UserAccountService.cs

示例8: DeleteGalleryItemMeta

        /// <summary>
        /// Deletes the meta tag value from the specified gallery items.
        /// </summary>
        /// <param name="galleryItemMeta">An instance of <see cref="Entity.GalleryItemMeta" /> that defines
        /// the tag value to be added and the gallery items it is to be added to.</param>
        /// <exception cref="System.Web.Http.HttpResponseException"></exception>
        public HttpResponseMessage DeleteGalleryItemMeta(Entity.GalleryItemMeta galleryItemMeta)
        {
            // /api/galleryitemmeta
            try
            {
                var mType = (MetadataItemName)galleryItemMeta.MetaItem.MTypeId;
                if (mType == MetadataItemName.Tags || mType == MetadataItemName.People)
                {
                    MetadataController.DeleteTag(galleryItemMeta);
                }
                else
                {
                    MetadataController.Delete(galleryItemMeta);
                }

                return new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent("Meta item deleted...")
                };
            }
            catch (GallerySecurityException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex);

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:41,代码来源:GalleryItemMetaController.cs

示例9: SpriteRenderer

 public SpriteRenderer(Entity parent)
     : base(parent)
 {
     this.Color = Color.White;
     this.Scale = 1;
     this.SpriteEffects = SpriteEffects.None;
 }
开发者ID:sippeangelo,项目名称:DepthsBelow,代码行数:7,代码来源:SpriteRenderer.cs

示例10: Listar

 /// <summary>Método que representa la llamada al procedure 'Partida_Listar'</summary>
 public static List<Entity.Partida.Listar> Listar(Entity.Partida Item, Cursor oCursor)
 {
     var ResultSet = new List<Entity.Partida.Listar>();
     SqlCommand oComando = oCursor.ObtenerComando(Contexto.CnControlPresupuesto);
     string Esquema = Galeria.Conexiones[(int)Contexto.CnControlPresupuesto].EsquemaDefecto;
     oComando.CommandText = Esquema + "Partida_Listar";
     try
     {
         using (SqlDataReader oLector = oComando.ExecuteReader())
         {
             while (oLector.Read())
             {
                 var LItem = new Entity.Partida.Listar();
                 LItem.idPartida = (string)oLector["idPartida"];
                 LItem.Partida = (string)oLector["Partida"];
                 LItem.Estado = (string)oLector["Estado"];
                 ResultSet.Add(LItem);
             }
         }
         return ResultSet;
     }
     catch (System.Exception)
     {
         throw;
     }
 }
开发者ID:CristianAngelPumaVillalva96,项目名称:Presupuestos,代码行数:27,代码来源:Partida.cs

示例11: RandomMoveBehaviour

        public RandomMoveBehaviour(Entity entity)
        {
            _currentDirection = Vector3.up;
            _distanceTraveledInThisDirection = 0;

            _entity = entity;
        }
开发者ID:W0dan,项目名称:CaveDwellers_Unity,代码行数:7,代码来源:RandomMoveBehaviour.cs

示例12: Execute

        public OrganizationResponse Execute(OrganizationRequest request, XrmFakedContext ctx)
        {
            var assignRequest = (AssignRequest)request;

            var target = assignRequest.Target;
            var assignee = assignRequest.Assignee;

            if (target == null)
            {
                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), "Can not assign without target");
            }

            if (assignee == null)
            {
                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), "Can not assign without assignee");
            }

            var service = ctx.GetFakedOrganizationService();

            var assignment = new Entity
            {
                LogicalName = target.LogicalName,
                Id = target.Id,
                Attributes = new AttributeCollection
                {
                    { "ownerid", assignee }
                }
            };

            service.Update(assignment);

            return new AssignResponse();
        }
开发者ID:ccellar,项目名称:fake-xrm-easy,代码行数:33,代码来源:AssignRequestExecutor.cs

示例13: Can_load_entity

		public void Can_load_entity()
		{
			var specialId = "SHA1-UdVhzPmv0o+wUez+Jirt0OFBcUY=";

			using (base.GetNewServer())
			{
				IDocumentStore documentStore = new DocumentStore
				{
					Url = "http://localhost:8080"
				}.Initialize();

				using(var store = documentStore)
				{
					store.Initialize();

					using (var session = store.OpenSession())
					{
						var entity = new Entity() { Id = specialId };
						session.Store(entity);
						session.SaveChanges();
					}

					using (var session = store.OpenSession())
					{
						var entity1 = session.Load<object>(specialId);
						Assert.NotNull(entity1);
					}
				}
			}
		}
开发者ID:nhsevidence,项目名称:ravendb,代码行数:30,代码来源:WithBase64Characters.cs

示例14: WithSeries

        public static void WithSeries(this IEnumerable<CFindResponse> cFinds, DICOMSCU scu, Entity daemon)
        {
            var iods = cFinds.Where(r => r.Status == (ushort)Status.PENDING)
            .Where(r => r.HasData)
            .Where(r => r.Data.Elements.Any(e => e.Tag == TagHelper.STUDY_INSTANCE_UID))
            .Where(r => !string.IsNullOrEmpty(r.Data.Elements.First(e => e.Tag == TagHelper.STUDY_INSTANCE_UID).DData as string))
            .Select(r => r.GetIOD())
            .ToList();
            
            iods.ForEach(i=>i.QueryLevel = QueryLevel.SERIES);

            foreach (var iod in iods)
            {
                var req = new CFindRequest(iod, Root.STUDY);
                var seriesUids = scu.GetResponse(req, daemon)
                     .Where(r => r.Status == (ushort)Status.PENDING)
                     .Where(r => r.HasData)
                     .Where(r => r.Data.Elements.Any(e => e.Tag == TagHelper.SERIES_INSTANCE_UID))
                     .Select(r => new
                     {
                        // Study = study,
                         Series = r.Data.GetSelector().SeriesInstanceUID.Data,
                         Modality = r.Data.GetSelector().Modality.Data
                     })
                     .ToList();
                System.Console.Write("");
            }
        }
开发者ID:Baasanjav,项目名称:Evil-DICOM,代码行数:28,代码来源:DIMSEExtensions.cs

示例15: GenerateRandomAccountCollection

        private EntityCollection GenerateRandomAccountCollection()
        {
            var collection = new List<Entity>();
            for (var i = 0; i < 10; i++)
            {
                var rgn = new Random((int)DateTime.Now.Ticks);
                var entity = new Entity("account");
                entity["accountid"] = entity.Id = Guid.NewGuid();
                entity["address1_addressid"] = Guid.NewGuid();
                entity["modifiedon"] = DateTime.Now;
                entity["lastusedincampaign"] = DateTime.Now;
                entity["donotfax"] = rgn.NextBoolean();
                entity["new_verybignumber"] = rgn.NextInt64();
                entity["exchangerate"] = rgn.NextDecimal();
                entity["address1_latitude"] = rgn.NextDouble();
                entity["numberofemployees"] = rgn.NextInt32();
                entity["primarycontactid"] = new EntityReference("contact", Guid.NewGuid());
                entity["revenue"] = new Money(rgn.NextDecimal());
                entity["ownerid"] = new EntityReference("systemuser", Guid.NewGuid());
                entity["industrycode"] = new OptionSetValue(rgn.NextInt32());
                entity["name"] = rgn.NextString(15);
                entity["description"] = rgn.NextString(300);
                entity["statecode"] = new OptionSetValue(rgn.NextInt32());
                entity["statuscode"] = new OptionSetValue(rgn.NextInt32());
                collection.Add(entity);
            }

            return new EntityCollection(collection);
        }
开发者ID:guusvanw,项目名称:Guus.Xrm,代码行数:29,代码来源:GenericXrmServiceTest.cs


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