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

C# EntityManager类代码示例

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

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



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

示例1: QueryRoles

        public async Task QueryRoles()
        {
            //Assert.Inconclusive("See comments in the QueryRoles test");

            // Issues:
            //
            // 1.  When the RoleType column was not present in the Role entity in the database (NorthwindIB.sdf), 
            //     the query failed with "Internal Server Error".  A more explanatory message would be nice.  
            //     The RoleType column has been added (nullable int), so this error no longer occurs.
            //
            // 2.  Comment out the RoleType property in the client model (Model.cs in Client\Model_Northwind.Sharp project lines 514-517).
            //     In this case, the client throws a null reference exception in CsdlMetadataProcessor.cs.
            //     This is the FIRST problem reported by the user.  A more informative message would be helpful.
            //
            // Note that this condition causes many other tests to fail as well.
            //
            // 3.  Uncomment the RoleType property in the client model.  Then the client throws in JsonEntityConverter.cs.
            //     This is the SECOND problem reported by the user.  This looks like a genuine bug that should be fixed.
            //

            var manager = new EntityManager(_serviceName);
                // Metadata must be fetched before CreateEntity() can be called
                await manager.FetchMetadata();

                var query = new EntityQuery<Role>();
                var allRoles = await manager.ExecuteQuery(query);

                Assert.IsTrue(allRoles.Any(), "There should be some roles defined");
        }
开发者ID:baotnq,项目名称:breeze.sharp.samples,代码行数:29,代码来源:QueryDatatypeTests.cs


示例2: Resolve

    public EntityError Resolve(EntityManager em) {
      IsServerError = true;
      try {
        EntityType entityType = null;
        if (EntityTypeName != null) {
          var stName = StructuralType.ClrTypeNameToStructuralTypeName(EntityTypeName);
          entityType = MetadataStore.Instance.GetEntityType(stName);
          var ek = new EntityKey(entityType, KeyValues);
          Entity = em.FindEntityByKey(ek);
        }

        if (PropertyName != null) {
          PropertyName = MetadataStore.Instance.NamingConvention.ServerPropertyNameToClient(PropertyName);
        }
        if (Entity != null) {
          Property = entityType.GetProperty(PropertyName);
          var vc = new ValidationContext(this.Entity);
          vc.Property = this.Property;
          var veKey = (ErrorName ?? ErrorMessage) + (PropertyName ?? "");
          var ve = new ValidationError(null, vc, ErrorMessage, veKey);
          ve.IsServerError = true;
          this.Entity.EntityAspect.ValidationErrors.Add(ve);
        }
      } catch (Exception e) {
        ErrorMessage = ( ErrorMessage ?? "") + ":  Unable to Resolve this error: " + e.Message;
      }
      return this;
    }
开发者ID:Cosmin-Parvulescu,项目名称:Breeze,代码行数:28,代码来源:SaveException.cs


示例3: TransformSystem

 public TransformSystem(EntityManager em, EntitySystemManager esm)
     : base(em, esm)
 {
     EntityQuery = new EntityQuery();
     EntityQuery.AllSet.Add(typeof(TransformComponent));
     EntityQuery.Exclusionset.Add(typeof(SlaveMoverComponent));
 }
开发者ID:Tri125,项目名称:space-station-14,代码行数:7,代码来源:TransformSystem.cs


示例4: MeteorFactory

        public MeteorFactory(EntityManager entityManager, ContentManager contentManager)
        {
            _entityManager = entityManager;

            _meteorRegions = new Dictionary<int, TextureRegion2D[]>()
            {
                { 4, new [] 
                    {
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_big1")),
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_big2")),
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_big3")),
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_big4"))
                    }
                },
                { 3, new []
                    {
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_med1")),
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_med3"))
                    }
                },
                { 2, new []
                    {
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_small1")),
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_small2"))
                    }
                },
                { 1, new []
                    {
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_tiny1")),
                        new TextureRegion2D(contentManager.Load<Texture2D>("meteorBrown_tiny2"))
                    }
                }

            };
        }
开发者ID:detuur,项目名称:MonoGame.Extended,代码行数:35,代码来源:MeteorFactory.cs


示例5: RedirectedCheckAgainst

 public override CollResult RedirectedCheckAgainst(zCollisionPrimitive other, EntityManager.Transform myRoot, EntityManager.Transform hisRoot)
 {
     CollResult ret = new CollResult();
     ret.collided = false;
     ret.normal = Vector2.Zero;
     return ret;
 }
开发者ID:MattDBell,项目名称:GCubed,代码行数:7,代码来源:zCollisionRay.cs


示例6: ValidateSave

        protected override bool ValidateSave()
        {
            base.ValidateSave();

            // Create a sandbox to do the validation in.
            var em = new EntityManager(EntityManager);
            em.CacheStateManager.RestoreCacheState(EntityManager.CacheStateManager.GetCacheState());

            // Find all entities supporting custom validation                
            var entities =
                em.FindEntities(EntityState.AllButDetached).OfType<EntityBase>().ToList();

            foreach (var e in entities)
            {
                var entityAspect = EntityAspect.Wrap(e);
                if (entityAspect.EntityState.IsDeletedOrDetached()) continue;

                var validationErrors = new VerifierResultCollection();
                e.Validate(validationErrors);

                validationErrors =
                    new VerifierResultCollection(entityAspect.ValidationErrors.Concat(validationErrors.Errors));
                validationErrors.Where(vr => !entityAspect.ValidationErrors.Contains(vr))
                    .ForEach(entityAspect.ValidationErrors.Add);

                if (validationErrors.HasErrors)
                    throw new EntityServerException(validationErrors.Select(v => v.Message).ToAggregateString("\n"),
                                                    null,
                                                    PersistenceOperation.Save, PersistenceFailure.Validation);
            }

            return true;
        }
开发者ID:ValdimarThor,项目名称:Cocktail,代码行数:33,代码来源:SaveInterceptor.cs


示例7: btn_Checkout_Click

        protected void btn_Checkout_Click(object sender, EventArgs e)
        {
            string abc = "";
               // Response.Redirect("Checkout.aspx");
            int customerid = Convert.ToInt32(Session["customerid"].ToString());

            EntityManager<ShippingAddress> pcat = new EntityManager<ShippingAddress>();
            ShippingAddress procat = new ShippingAddress();
            procat.CustomerID = customerid;
            List<ShippingAddress> prodcatID = pcat.Search(procat);
            if (prodcatID.Count != 0)
            {
                abc = prodcatID[0].AddressLine1;
            }
            if (abc == "")
            {
                addressedit.Visible = true;
            }
            else
            {

                addressview.Visible = true;
            }
            btnfindis.Visible = true;
            btn_Checkout.Visible = false;
        }
开发者ID:vgopu2,项目名称:BISummer2015-P1-T2,代码行数:26,代码来源:Checkout.aspx.cs


示例8: RenderSystem

        public RenderSystem(LoderGame game, SystemManager systemManager, EntityManager entityManager)
        {
            _game = game;
            _systemManager = systemManager;
            _entityManager = entityManager;
            _animationManager = game.animationManager;
            //_sortedRenderablePrimitives = new SortedDictionary<float, List<IRenderablePrimitive>>();
            _cameraSystem = _systemManager.getSystem(SystemType.Camera) as CameraSystem;
            _graphicsDevice = game.GraphicsDevice;
            _spriteBatch = game.spriteBatch;
            _backgroundRenderer = new BackgroundRenderer(_spriteBatch);
            _fluidRenderTarget = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _renderedFluid = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _debugFluid = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceUnder = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceOver = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);

            _contentManager = new ContentManager(game.Services);
            _contentManager.RootDirectory = "Content";
            _fluidEffect = _contentManager.Load<Effect>("fluid_effect");
            _fluidParticleTexture = _contentManager.Load<Texture2D>("fluid_particle");
            _reticle = _contentManager.Load<Texture2D>("reticle");
            _materialRenderer = new MaterialRenderer(game.GraphicsDevice, _contentManager, game.spriteBatch);
            _primitivesEffect = _contentManager.Load<Effect>("effects/primitives");
            _pixel = new Texture2D(_graphicsDevice, 1, 1);
            _pixel.SetData<Color>(new [] { Color.White });
            _circle = _contentManager.Load<Texture2D>("circle");
            _tooltipFont = _contentManager.Load<SpriteFont>("shared_ui/tooltip_font");
        }
开发者ID:klutch,项目名称:StasisEngine,代码行数:29,代码来源:RenderSystem.cs


示例9: CreateEntity

 public static int CreateEntity(
     EntityManager entityManager,
     IBlueprintManager blueprintManager,
     string blueprintId)
 {
     return CreateEntity(entityManager, blueprintManager, blueprintId, null);
 }
开发者ID:jixiang111,项目名称:slash-framework,代码行数:7,代码来源:GameBlueprintUtils.cs


示例10: Resolve

    public EntityError Resolve(EntityManager em) {
      IsServerError = true;
      try {
        EntityType entityType = null;
        if (EntityTypeName != null) {
          var stName = TypeNameInfo.FromClrTypeName(EntityTypeName).ToClient(em.MetadataStore).StructuralTypeName;
          entityType = em.MetadataStore.GetEntityType(stName);
          var ek = new EntityKey(entityType, KeyValues);
          Entity = em.GetEntityByKey(ek);
        }

        
        if (entityType != null) {
          if (PropertyName != null) {
            Property = entityType.Properties.FirstOrDefault(p => p.NameOnServer == PropertyName);
            if (Property != null) {
              PropertyName = Property.Name;
            }
          }
          
          var vc = new ValidationContext(this.Entity);
          vc.Property = Property;
          var veKey = (ErrorName ?? ErrorMessage) + (PropertyName ?? "");
          var ve = new ValidationError(null, vc, ErrorMessage, veKey);
          ve.IsServerError = true;
          this.Entity.EntityAspect.ValidationErrors.Add(ve);
        }
      } catch (Exception e) {
        ErrorMessage = ( ErrorMessage ?? "") + ":  Unable to Resolve this error: " + e.Message;
      }
      return this;
    }
开发者ID:hiddenboox,项目名称:breeze.sharp,代码行数:32,代码来源:SaveException.cs


示例11: CreateFakeExistingCustomer

 // Useful utility method
 private Customer CreateFakeExistingCustomer(EntityManager entityManager, string companyName = "Existing Customer") {
     var customer = new Customer();
     customer.CompanyName = companyName;
     customer.CustomerID = Guid.NewGuid();
     entityManager.AttachEntity(customer);
     return customer;
 }
开发者ID:baotnq,项目名称:breeze.sharp.samples,代码行数:8,代码来源:NavigationTests.cs


示例12: ComputeLod

        private void ComputeLod(Node root, double k, EntityManager entityManager)
        {
            var mesh = entityManager.GetComponent<StaticMesh>(root.Entity);

            var side = (root.Bounds.Max - root.Bounds.Min).X;
            var radius = Math.Sqrt(side*side + side*side);

            for (int i = 0; i < 6; i++)
            {
                if (PlaneDistance(_frustumPlanes[i], root.Bounds.Center) <= -radius)
                {
                    return;
                }
            }

            var error = root.GeometricError;
            var distance = (root.Bounds.Center - _camera.Position).Length;
            var rho = (error / distance) * k;

            var threshhold = 100;
            if (rho <= threshhold || root.Leafs.Length == 0)
            {
                mesh.IsVisible = true;
            }
            else
            {
                for (int j = 0; j < root.Leafs.Length; j++)
                {
                    ComputeLod(root.Leafs[j], k, entityManager);
                }
            }
        }
开发者ID:smoothdeveloper,项目名称:ProceduralGeneration,代码行数:32,代码来源:ChunkedLODSystem.cs


示例13: ExportImportFromIsolatedStorage

        public async Task ExportImportFromIsolatedStorage()
        {
            var manager1 = new EntityManager(_serviceName);
            await PrimeCache(manager1);
            var expectedEntityCount = manager1.GetEntities().Count();

            var exportData = manager1.ExportEntities();

            var isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
            string importData;
            using (var isoStream = new IsolatedStorageFileStream("ExportEntities.txt", FileMode.Create, isoStore))
            {
                using (var writer = new StreamWriter(isoStream))
                {
                    writer.Write(exportData);
                }
            }

            using (var isoStream = new IsolatedStorageFileStream("ExportEntities.txt", FileMode.Open, isoStore))
            {
                using (var reader = new StreamReader(isoStream))
                {
                    importData = reader.ReadToEnd();
                }
            }
            
            // import into a new EntityManager
            var manager2 = new EntityManager(_serviceName);
            manager2.ImportEntities(importData);

            Assert.AreEqual(expectedEntityCount, manager2.GetEntities().Count());
        }
开发者ID:baotnq,项目名称:breeze.sharp.samples,代码行数:32,代码来源:ExportImportTests.cs


示例14: EntityWorld

 public EntityWorld()
 {
     _systemManager = new SystemManager(this);
     _entityManager = new EntityManager(this);
     _tagManager = new TagManager(this);
     _gameTime = new AmphibianGameTime();
 }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:7,代码来源:EntityWorld.cs


示例15: JsonEntityConverter

 public JsonEntityConverter(EntityManager entityManager, MergeStrategy mergeStrategy, Func<String, String> normalizeTypeNameFn = null) {
   _entityManager = entityManager;
   _metadataStore = entityManager.MetadataStore;
   _mergeStrategy = mergeStrategy;
   _normalizeTypeNameFn = normalizeTypeNameFn;
   _allEntities = new List<IEntity>();
 }
开发者ID:CodeLancer,项目名称:Breeze,代码行数:7,代码来源:JsonEntityConverter.cs


示例16: RenderingSystem

 public RenderingSystem(Form form, EntityManager manager)
     : base(manager)
 {
     _form = form;
     _halfWidth = form.ClientRectangle.Width / 2;
     _halfHeight = form.ClientRectangle.Height / 2;
 }
开发者ID:jjvdangelo,项目名称:EStroids,代码行数:7,代码来源:RenderingSystem.cs


示例17: CheckAgainst

    public override CollResult CheckAgainst(zCollisionPrimitive other, EntityManager.Transform myRoot, EntityManager.Transform hisRoot)
    {
        //Transform both into correct space
        if(other is zCollisionAABB)
        {
            CollResult ret = new CollResult();
            ret.collided = false;
            ret.normal = Vector2.Zero;
            Rectangle mine = m_rect;
            mine.Offset((int)myRoot.GetPos().X, (int)myRoot.GetPos().Y);

            Rectangle his = (other as zCollisionAABB).m_rect;
            his.Offset((int)hisRoot.GetPos().X, (int)hisRoot.GetPos().Y);

            if(mine.Intersects(his))
            {
                ret.collided = true;
                ret.normal = new Vector2(his.Center.X - mine.Center.X, his.Center.Y - mine.Center.Y);
                ret.normal.Normalize();
            }
            return ret;
        }

        //Oh no we can't handle any others.
        return other.RedirectedCheckAgainst(this, hisRoot, myRoot); //Note the swap of transforms
    }
开发者ID:MattDBell,项目名称:GCubed,代码行数:26,代码来源:zCollisionAABB.cs


示例18: EventSystem

 public EventSystem(SystemManager systemManager, EntityManager entityManager)
 {
     _systemManager = systemManager;
     _entityManager = entityManager;
     _levelSystem = (LevelSystem)_systemManager.getSystem(SystemType.Level);
     _handlers = new Dictionary<GameEventType,Dictionary<int,List<IEventHandler>>>();
 }
开发者ID:klutch,项目名称:StasisEngine,代码行数:7,代码来源:EventSystem.cs


示例19: btnfinalize_Click

        protected void btnfinalize_Click(object sender, EventArgs e)
        {
            Dictionary<int, int> cartItems1 = (Dictionary<int, int>)Session["ShoppingCart"];
            int prodid1;
            int prodqty1;

            foreach (KeyValuePair<int, int> productidQty in cartItems1)
            {
                prodid1 = productidQty.Key;
                prodqty1 = productidQty.Value;

                EntityManager<ProductListing> pcat = new EntityManager<ProductListing>();
                ProductListing procat = new ProductListing();
                procat.ProductID = prodid1;
                List<ProductListing> prodcatID = pcat.Search(procat);

            }

               // ShoppingCrt.
            //EntityManager<ShippingAddress> pcat = new EntityManager<ShippingAddress>();
            //ShippingAddress procat = new ShippingAddress();
            //procat.CustomerID = 10;
            //procat.AddressLine1 = "sdfag";

            //List<ShippingAddress> prodcatID = pcat.Insert(procat);
        }
开发者ID:vgopu2,项目名称:BISummer2015-P1-T2,代码行数:26,代码来源:Checkout.aspx.cs


示例20: TestInitialize

 public void TestInitialize()
 {
     Game game = new Game();
     EntityManager entityManager = new EntityManager(game);
     // Create compound entities.
     new CompoundEntities<TestCompound>(entityManager);
 }
开发者ID:jixiang111,项目名称:slash-framework,代码行数:7,代码来源:CompoundEntitiesTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# EntityMetadata类代码示例发布时间:2022-05-24
下一篇:
C# EntityKey类代码示例发布时间: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