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


C# EntityManager类代码示例

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


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


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