Ejemplo n.º 1
0
        public AbstractField(IEntity entity, string name)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (!NamingRule.IsValidFieldName(name))
            {
                throw new ArgumentOutOfRangeException(nameof(name), $"Invalid field name: {name}");
            }

            if (entity.Fields.ContainsKey(name))
            {
                var msg = string.Format("Duplicate field name '{0}'", name);
                throw new ArgumentOutOfRangeException(nameof(name), msg);
            }

            this.SetName(name);
            this.Entity = entity;

            this.Label              = string.Empty;
            this.IsRequired         = false;
            this.Lazy               = false;
            this.CriterionConverter = null;
        }
Ejemplo n.º 2
0
        public AbstractField(IModel model, string name)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (!NamingRule.IsValidFieldName(name))
            {
                throw new ArgumentOutOfRangeException("name", "Invalid field name: " + name);
            }

            if (model.Fields.ContainsKey(name))
            {
                var msg = string.Format("Duplicate field name '{0}'", name);
                throw new ArgumentOutOfRangeException("name", msg);
            }

            this.SetName(name);
            this.Model = model;

            this.Label              = string.Empty;
            this.IsRequired         = false;
            this.Lazy               = false;
            this.CriterionConverter = null;
        }
Ejemplo n.º 3
0
        public AbstractField(IEntity entity, string name, FieldType type)
            : this(entity, name)
        {
            this.Type = type;

            if (entity == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (!NamingRule.IsValidFieldName(name))
            {
                throw new ArgumentOutOfRangeException(nameof(name), "Invalid field name: " + name);
            }
        }
Ejemplo n.º 4
0
        public AbstractField(IModel model, string name, FieldType type)
            : this(model, name)
        {
            this.Type = type;

            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (!NamingRule.IsValidFieldName(name))
            {
                throw new ArgumentOutOfRangeException("name", "Invalid field name: " + name);
            }
        }