Example #1
0
        private dynamic EntityFor(DynamicModel model, dynamic attributes)
        {
            var entity = new Gemini(attributes);

            entity.SetMember(ForeignKeyFor(model), model.GetMember(Id()));

            return(Repository.Projection(entity));
        }
Example #2
0
        public void Init(DynamicModel model)
        {
            string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(Repository) : ForeignKey;

            string primaryKeyName = string.IsNullOrEmpty(PrimaryKey) ? "Id" : PrimaryKey;

            string whereClause = string.Format("{0} = @0", primaryKeyName);

            model.SetUnTrackedMember(
                Named,
                new DynamicFunction(() => Repository.SingleWhere(whereClause, model.GetMember(foreignKeyName))));
        }
Example #3
0
        public bool Validate(DynamicModel entity)
        {
            dynamic value = entity.GetMember(Property);

            if (value == null && IgnoreNull == true)
            {
                return(true);
            }

            if (value == null)
            {
                return(false);
            }

            int length = value.Length;

            if (Minimum != null && length < Minimum)
            {
                return(false);
            }

            if (Maximum != null && length > Maximum)
            {
                return(false);
            }

            if (In != null && !In.Contains(length))
            {
                return(false);
            }

            if (Is != null && length != Is)
            {
                return(false);
            }

            return(true);
        }
Example #4
0
        public bool Validate(DynamicModel entity)
        {
            dynamic value = entity.GetMember(Property);

            if (value == null && IgnoreNull == true) return true;

            if (value == null) return false;

            int length = value.Length;

            if (Minimum != null && length < Minimum) return false;

            if (Maximum != null && length > Maximum) return false;

            if (In != null && !In.Contains(length)) return false;

            if (Is != null && length != Is) return false;

            return true;
        }
Example #5
0
        private dynamic EntityFor(DynamicModel model, dynamic attributes)
        {
            var entity = new Gemini(attributes);

            entity.SetMember(ForeignKeyFor(model), model.GetMember(Id()));

            return repository.Projection(entity);
        }
Example #6
0
        public void Init(DynamicModel model)
        {
            string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(model) : ForeignKey;

            model.SetUnTrackedMember(
                Singular(Repository),
                new DynamicFunction(() => Repository.SingleWhere(foreignKeyName + " = @0", model.GetMember(Id()))));
        }
Example #7
0
        public void Init(DynamicModel model)
        {
            string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(Repository) : ForeignKey;

            string primaryKeyName = string.IsNullOrEmpty(PrimaryKey) ? "Id" : PrimaryKey;

            string whereClause = string.Format("{0} = @0", primaryKeyName);

            model.SetUnTrackedMember(
                Named,
                new DynamicFunction(() => Repository.SingleWhere(whereClause, model.GetMember(foreignKeyName))));
        }
Example #8
0
        public void Init(DynamicModel model)
        {
            string foreignKeyName = string.IsNullOrEmpty(ForeignKey) ? ForeignKeyFor(model) : ForeignKey;

            model.SetUnTrackedMember(
                Singular(Repository),
                new DynamicFunction(() => Repository.SingleWhere(foreignKeyName + " = @0", model.GetMember(Id()))));
        }