public override void Given()
        {
            someEntity = new SomeEntity();
            someEntity.Screen_Name_To_Return = "Sreen";

            entityView = Moq.Mock <IEntityView <SomeEntity> >();

            partPresenters = new[] { Moq.Mock <IPartPresenter>() };
        }
Exemplo n.º 2
0
        public CustomerTests()
        {
            var name = Guid.NewGuid().ToString();
            var add  = new EntityAddCommand();

            _entityView = add.EntityAdd(new EntityAdd()
            {
                Name = name
            }).Result;
        }
Exemplo n.º 3
0
 public DefaultEntityConditionBuilder(
     Schema.Schema schema, EntityModel <T> entitySchema,
     EntityExpressionConverter <T> expressionConverter = null,
     IEntityView <T> modelTranscriber = null)
 {
     Schema               = schema;
     EntityModel          = entitySchema;
     _expressionConverter = expressionConverter;
     _entityView          = modelTranscriber ?? entitySchema.GetEntityView <T>();
 }
Exemplo n.º 4
0
 public override void Remove(IEntityView entityView)
 {
     if (entityView is U)
     {
         Remove((U)entityView);
     }
     else
     {
         base.Remove(entityView);
     }
 }
Exemplo n.º 5
0
 public override void Add(IEntityView entityView)
 {
     if (entityView is U)
     {
         Add((U)entityView);
     }
     else
     {
         base.Add(entityView);
     }
 }
Exemplo n.º 6
0
        public static void MonitorAddDuration(IHandleEntityViewEngine engine, IEntityView entityView)
        {
            EngineInfo info;

            if (engineInfos.TryGetValue(engine.GetType(), out info))
            {
                _stopwatch.Start();
                engine.Add(entityView);
                _stopwatch.Stop();
                info.AddAddDuration(_stopwatch.Elapsed.TotalMilliseconds);
                _stopwatch.Reset();
            }
        }
Exemplo n.º 7
0
        public override void Add(IEntityView entityView)
        {
            var castedEntityView = entityView as U;

            if (castedEntityView != null)
            {
                Add(castedEntityView);
            }
            else
            {
                base.Add(entityView);
            }
        }
Exemplo n.º 8
0
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
 //! Queを処理する
 public override void ProcessQueue()
 {
     // 生成
     {
         // Effect
         int effectQueLength = _unitQue.GetBookLength();
         for (int i = 0; i < effectQueLength; ++i)
         {
             ITestUnitLogic obj  = _unitQue.Get(i);
             IEntityView    view = _unitViewPool.GetView(obj.Kind);
             AddEntityToLifeCycle(obj, view);
         }
         _unitQue.ListClear();
     }
 }
Exemplo n.º 9
0
        private static void AttemptWriteToObject <TView, TData>(TView obj, TData data, EntityField <T> entityField,
                                                                IEntityView <TView> entityView)
            where TView : class
        {
            var intersectedFields = entityView.EntityToClassIntersection
                                    .IntersectedFields.FirstOrDefault(q => q.LeftField == entityField);

            if (intersectedFields == null)
            {
                return;
            }

            var writer = new ObjectGraphReaderWriter <TView>(obj);

            writer.Write(intersectedFields.RightPath, data);
        }
Exemplo n.º 10
0
        public void RemoveEntity(IEntityLogicPeek obj)
        {
            if (_entities.ContainsKey(obj))
            {
                IEntityView view = _entities[obj];
                if (view.IsPool)
                {
                    view.DeactiveView();
                }
                else
                {
                    Object.Destroy(view.GameObject);
                }

                _entities.Remove(obj);
            }
        }
Exemplo n.º 11
0
        // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
        //! Viewを取得する (Viewの初期化も行う)
        public IEntityView GetView(TestUnitLogic.EKind kind)
        {
            IEntityView view = null;

            // View取得
            switch (kind)
            {
            case TestUnitLogic.EKind.NormalUnit: view = GetView(_blackSplashViews, _testUnitViewPrefab); break;

            default:
                throw new ArgumentOutOfRangeException("EKind", kind, null);
            }
            // Viewの初期化
            ActiveView(view);

            return(view);
        }
Exemplo n.º 12
0
        public SqlEntityStore(Schema.Schema schema, IDataProvider dataProvider)
        {
            _entityModel  = schema.GetEntityModel <T>();
            _dataProvider = dataProvider;

            if (_entityModel == null)
            {
                ExceptionHelper.ThrowNotPresentInSchema <T>();
            }

            QueryBuilder = new EntityQueryBuilder <T>(schema);

            _clientGeneratedPrimaryKey = _entityModel.Fields.FirstOrDefault(q => q.IsPrimaryKey && !q.IsSeverGenerated);
            _serverGeneratedPrimaryKey = _entityModel.Fields.FirstOrDefault(q => q.IsPrimaryKey && q.IsSeverGenerated);

            _entityTranscriber = _entityModel.GetEntityView(_entityModel.TypeModel);
        }
Exemplo n.º 13
0
        private DeferableInsert <T> Insert <TView>(IEntityView <TView> transcriber, TView entity)
            where TView : class
        {
            var mapBackInsertId    = _serverGeneratedPrimaryKey != null;
            var generatePrimaryKey = _clientGeneratedPrimaryKey != null;
            var insertBuilder      = QueryBuilder.Insert(entity);

            if (generatePrimaryKey)
            {
                var newId = Guid.NewGuid();
                insertBuilder.Assignments.Set(_clientGeneratedPrimaryKey, newId);
                AttemptWriteToObject(entity, newId, _clientGeneratedPrimaryKey, transcriber);
            }

            if (!mapBackInsertId)
            {
                return(new DeferableInsert <T>(
                           insertBuilder, _dataProvider
                           ));
            }

            var primaryKeyIntersectedFields = transcriber.EntityToClassIntersection.IntersectedFields
                                              .FirstOrDefault(q => q.LeftField == _serverGeneratedPrimaryKey);

            if (primaryKeyIntersectedFields == null)
            {
                return(new DeferableInsert <T>(
                           insertBuilder, _dataProvider
                           ));
            }

            return(new DeferableInsert <T>(
                       insertBuilder, _dataProvider,
                       QueryExpression.Select(
                           QueryExpression.Alias(QueryExpression.LastInsertIdFunction(), _serverGeneratedPrimaryKey.ProjectionAlias),
                           from: QueryExpression.Table(_entityModel.Table.TableName)
                           ),
                       new MapLastIdResultProcessor <TView>(
                           entity, primaryKeyIntersectedFields
                           )
                       ));
        }
Exemplo n.º 14
0
        protected string GetData(IEntityView view)
        {
            if (!(view?.Controls?.Any()).GetValueOrDefault())
            {
                throw new ArgumentNullException(nameof(view.Controls));
            }

            if (view.EntityType == null)
            {
                throw new ArgumentNullException(nameof(view.EntityType));
            }

            var select     = view.Controls.OfType <FieldControl>().Select(x => GetData((dynamic)x.Field));
            var from       = view.EntityType.Code;
            var innerJoins = view.Controls.OfType <FieldControl>().Where(x => x.Field.EntityType != view.EntityType).Select(x => x.Field.EntityType).Distinct();

            var where = new List <string>();

            return($"SELECT {string.Join(", ", select)} FROM {from} {string.Join(" ", innerJoins.Select(x => $"INNER JOIN {x.Code} ON {x.Code}.id = {view.EntityType.Code}.id"))}");
        }
        static void RemoveEntityViewFromEngines(Dictionary <Type, FasterList <IHandleEntityViewEngine> > entityViewEngines,
                                                IEntityView entityView, Type entityViewType)
        {
            FasterList <IHandleEntityViewEngine> enginesForEntityView;

            if (entityViewEngines.TryGetValue(entityViewType, out enginesForEntityView))
            {
                int count;
                var fastList = FasterList <IHandleEntityViewEngine> .NoVirt.ToArrayFast(enginesForEntityView, out count);

                for (int j = 0; j < count; j++)
                {
#if ENGINE_PROFILER_ENABLED && UNITY_EDITOR
                    EngineProfiler.MonitorRemoveDuration(fastList[j], entityView);
#else
                    fastList[j].Remove(entityView);
#endif
                }
            }
        }
Exemplo n.º 16
0
        public static IEntityView <T> ApplySimpleSort <T>(this IEntityView <T> view, string property)
            where T : class
        {
            Ensure.That(view).Named("view").IsNotNull();

            var actualDirection = view.SortDirection;
            var actualProperty  = view.SortProperty == null ? (string)null : view.SortProperty.Name;

            if (property != null && property == actualProperty)
            {
                /*
                 * Dobbiamo invertire il sort attuale.
                 */
                if (actualDirection == ListSortDirection.Ascending)
                {
                    actualDirection = ListSortDirection.Descending;
                }
                else
                {
                    actualDirection = ListSortDirection.Ascending;
                }

                var lsd = new ListSortDescription(view.GetProperty(property), actualDirection);
                view.ApplySort(new ListSortDescriptionCollection(new[] { lsd }));
            }
            else
            {
                /*
                 * Arriviamo qui se è un "nuovo" sort o se
                 * il sort è su null
                 */
                view.ApplySort(property);
            }

            return(view);
        }
Exemplo n.º 17
0
 public void Remove(IEntityView entityView)
 {
     Remove((T)entityView);
 }
Exemplo n.º 18
0
 public DefaultEntityConditionBuilder(Schema.Schema schema, EntityExpressionConverter <T> expressionConverter = null,
                                      IEntityView <T> modelTranscriber = null) :
     this(schema, schema.GetEntityModel <T>(), expressionConverter, modelTranscriber)
 {
 }
Exemplo n.º 19
0
 public RenderingSystem(ContainerProvider <GameState> ownerProvider) : base(ownerProvider)
 {
     // filter out entities that have both PhysicsObject and Drawable
     _drawableIds = EntityManager.GetView <PhysicsObject, Drawable>();
 }
Exemplo n.º 20
0
 public EntityForm(IPresentationModel subject, IEntityView view)
 {
     _presentationModel = subject;
     _view = view;
 }
Exemplo n.º 21
0
 public virtual void OnRollbackDestroy()
 {
     EntityView?.OnRollbackDestroy();
     EntityView      = null;
     engineTransform = null;
 }
Exemplo n.º 22
0
 public static IEnumerable <T> AsEntityItems <T>(this IEntityView <T> view)
     where T : class
 {
     return(view.Select(item => item.EntityItem));;
 }
Exemplo n.º 23
0
        public void BuildEntityViewAndAddToList(ref ITypeSafeList list, int entityID, out IEntityView entityView)
        {
            if (list == null)
            {
                list = new TypeSafeFasterListForECSForClasses <EntityViewType>();
            }

            var castedList = list as TypeSafeFasterListForECSForClasses <EntityViewType>;

            var lentityView = EntityView <EntityViewType> .BuildEntityView(entityID);

            castedList.Add(lentityView);

            entityView = lentityView;
        }
Exemplo n.º 24
0
        public void BuildEntityViewAndAddToList(ref ITypeSafeList list, int entityID, out IEntityView entityView)
        {
            var structEntityView = default(EntityViewType);

            structEntityView.ID = entityID;

            if (list == null)
            {
                list = new TypeSafeFasterListForECSForStructs <EntityViewType>();
            }

            var castedList = list as TypeSafeFasterListForECSForStructs <EntityViewType>;

            castedList.Add(structEntityView);

            entityView = null;
        }
Exemplo n.º 25
0
 public EditorView(IEntityView view, SpriteBatch spriteBatch)
     : base(view.Entity)
 {
     this.EditingView = view ?? throw new ArgumentNullException();
     _spriteBatch     = spriteBatch ?? throw new ArgumentNullException();
 }
Exemplo n.º 26
0
 public virtual void Add(IEntityView entityView)
 {
     Add((T)entityView);
 }
Exemplo n.º 27
0
 public void AddEntity(IEntityLogicPeek logic, IEntityView view)
 {
     view.Init(_entityFieldView, logic);
     _entities.Add(logic, view);
 }
        public void BuildEntityViewAndAddToList(ref ITypeSafeList list, EGID entityID, out IEntityView entityView)
        {
            _initializer.ID = entityID;

            if (list == null)
            {
                list = new TypeSafeFasterListForECSForStructs <EntityViewType>();
            }

            var castedList = list as TypeSafeFasterListForECSForStructs <EntityViewType>;

            castedList.Add(_initializer);

            entityView = null;
        }
Exemplo n.º 29
0
 public void Add(IEntityView entityView)
 {
     Add((T)entityView); //when byref returns will be vailable, this should be passed by reference, not copy!
 }