public ClassFilterTerm(ClassSchema schema, int ordinal, ClassFilterComparison comparison, object value)
 {
     this._Schema     = schema;
     this._Ordinal    = ordinal;
     this._Comparison = comparison;
     this._Value      = value;
     this._Acessor    = schema[ordinal];
 }
Ejemplo n.º 2
0
 public ClassFilterTerm(ClassSchema schema, int ordinal, ClassFilterComparison comparison, object value)
 {
     this._Schema = schema;
     this._Ordinal = ordinal;
     this._Comparison = comparison;
     this._Value = value;
     this._Acessor = schema[ordinal];
 }
        public FixedLengthAspectMember(ClassAcessor acessor, FixedLengthColumnAttribute colAttriute)
            : base(acessor)
        {
            this._CultureOverride = string.IsNullOrEmpty(colAttriute.CultureInfoOverride) ?
                null :
                System.Globalization.CultureInfo.GetCultureInfo(colAttriute.CultureInfoOverride);

            this._Adapter = colAttriute.ParserType == null ?
                Adapters.SimpleAdapters.CreateInstance(acessor.DataType, colAttriute.FormatString, this._CultureOverride) :
                (Adapters.SimpleAdapter)Activator.CreateInstance(colAttriute.ParserType);

            this._Offset = colAttriute.Offset;
            this._Length = colAttriute.Length;
        }
        public FixedLengthAspectMember(ClassAcessor acessor, FixedLengthColumnAttribute colAttriute)
            : base(acessor)
        {
            this._CultureOverride = string.IsNullOrEmpty(colAttriute.CultureInfoOverride) ?
                                    null :
                                    System.Globalization.CultureInfo.GetCultureInfo(colAttriute.CultureInfoOverride);

            this._Adapter = colAttriute.ParserType == null?
                            Adapters.SimpleAdapters.CreateInstance(acessor.DataType, colAttriute.FormatString, this._CultureOverride) :
                                (Adapters.SimpleAdapter)Activator.CreateInstance(colAttriute.ParserType);


            this._Offset = colAttriute.Offset;
            this._Length = colAttriute.Length;
        }
        protected override bool CreateAspectFor(ClassAcessor acessor, out SingleAnnotationAspectMember <TMemberAspect> member)
        {
            TMemberAspect tma = acessor.GetAttribute <TMemberAspect>(true);

            if (tma == null)
            {
                member = null;
                return(false);
            }
            else
            {
                member = new SingleAnnotationAspectMember <TMemberAspect>(acessor, tma);
                return(true);
            }
        }
        protected override bool CreateAspectFor(ClassAcessor acessor, out FixedLengthAspectMember member)
        {
            FixedLengthColumnAttribute flca = acessor.GetAttribute <FixedLengthColumnAttribute>(true);

            if (flca == null)
            {
                member = null;
                return(false);
            }
            else
            {
                member = new FixedLengthAspectMember(acessor, flca);
                return(true);
            }
        }
Ejemplo n.º 7
0
        public XmlAspectMemberList(ClassAcessor acessor, string localName, bool mandatory)
            : base(acessor, localName, mandatory)
        {
            Type[] genericTypes = base.DataType.GetGenericArguments();
            if (genericTypes.Length != 1)
            {
                throw new ArgumentException("List serialization must be with IList of one generic type: " + DataType);
            }

            _Constructor = genericTypes[0].GetConstructor(Type.EmptyTypes);
            if (_Constructor == null)
            {
                throw new ArgumentException("List serialization requires that the components have a default constructor: " + genericTypes[0]);
            }

            this._Aspect = XmlAspect.GetInstance(genericTypes[0]);
        }
        public XmlAspectMemberList(ClassAcessor acessor, string localName, bool mandatory)
            : base(acessor, localName, mandatory)
        {
            Type[] genericTypes = base.DataType.GetGenericArguments();
            if (genericTypes.Length != 1)
            {
                throw new ArgumentException("List serialization must be with IList of one generic type: " + DataType);
            }

            _Constructor = genericTypes[0].GetConstructor(Type.EmptyTypes);
            if (_Constructor == null)
            {
                throw new ArgumentException("List serialization requires that the components have a default constructor: " + genericTypes[0]);

            }

            this._Aspect = XmlAspect.GetInstance(genericTypes[0]);
        }
 /// <summary>
 /// Constructs the data member.
 /// </summary>
 /// <param name="acessor">The member acessor for get and set values.</param>
 /// <param name="storedName">The stored name of the class or null if it's the accessor name.</param>
 /// <param name="identity">The identity flag.</param>
 /// <param name="unique">The unique member flag (only used if not an identity).</param>
 /// <param name="primaryKey">The primary key flag (only used if not an identity or unique).</param>
 /// <param name="nullable">The nullable flag.</param>
 /// <param name="generator">The value generators for storage io.</param>
 public DataAspectMember(
     ClassAcessor acessor,
     string storedName,
     bool identity,
     bool unique,
     bool primaryKey,
     bool nullable,
     Generator generator,
     string caption)
     : base(acessor)
 {
     this._StoredName = string.IsNullOrEmpty(storedName) ? acessor.Name : storedName;
     this._Identity   = identity;
     this._Unique     = unique;
     this._PrimaryKey = primaryKey;
     this._Nullable   = nullable;
     this._Generator  = generator;
     this._Caption    = string.IsNullOrEmpty(caption) ? acessor.Name : caption;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructs the data member.
 /// </summary>
 /// <param name="acessor">The member acessor for get and set values.</param>
 /// <param name="storedName">The stored name of the class or null if it's the accessor name.</param>
 /// <param name="identity">The identity flag.</param>
 /// <param name="unique">The unique member flag (only used if not an identity).</param>
 /// <param name="primaryKey">The primary key flag (only used if not an identity or unique).</param>
 /// <param name="nullable">The nullable flag.</param>
 /// <param name="generator">The value generators for storage io.</param>
 public DataAspectMember(
     ClassAcessor acessor,
     string storedName,
     bool identity,
     bool unique,
     bool primaryKey,
     bool nullable,
     Generator generator,
     string caption)
     : base(acessor)
 {
     this._StoredName = string.IsNullOrEmpty(storedName) ? acessor.Name : storedName;
     this._Identity = identity;
     this._Unique = unique;
     this._PrimaryKey = primaryKey;
     this._Nullable = nullable;
     this._Generator = generator;
     this._Caption = string.IsNullOrEmpty(caption) ? acessor.Name : caption;
 }
Ejemplo n.º 11
0
        protected override bool CreateAspectFor(ClassAcessor acessor, out DataAspectMember member)
        {
            DatabaseColumnAttribute dca = acessor.GetAttribute<DatabaseColumnAttribute>(true);
            if (dca == null)
            {
                member = null;
                return false;
            }
            else
            {
                member = new DataAspectMember(
                    acessor,
                    dca.StoredName,
                    dca.ColumnKind == DatabaseColumnKind.Identity,
                    dca.ColumnKind == DatabaseColumnKind.Unique,
                    dca.ColumnKind == DatabaseColumnKind.PrimaryKey,
                    dca.IsNullable,
                    acessor.GetAttribute<Generator>(true));

                return true;
            }
        }
Ejemplo n.º 12
0
        protected override bool CreateAspectFor(ClassAcessor acessor, out DataAspectMember member)
        {
            DatabaseColumnAttribute dca = acessor.GetAttribute <DatabaseColumnAttribute>(true);

            if (dca == null)
            {
                member = null;
                return(false);
            }
            else
            {
                member = new DataAspectMember(
                    acessor,
                    dca.StoredName,
                    dca.ColumnKind == DatabaseColumnKind.Identity,
                    dca.ColumnKind == DatabaseColumnKind.Unique,
                    dca.ColumnKind == DatabaseColumnKind.PrimaryKey,
                    dca.IsNullable,
                    acessor.GetAttribute <Generator>(true));

                return(true);
            }
        }
Ejemplo n.º 13
0
        protected override bool CreateAspectFor(ClassAcessor acessor, out HtmlInputAspectMember member)
        {
            HtmlInputAttribute hia = acessor.GetAttribute <HtmlInputAttribute>(true);

            if (hia == null)
            {
                member = null;
                return(false);
            }
            else
            {
                member = new HtmlInputAspectMember(
                    acessor,
                    hia.Fieldset,
                    hia.InferType ? HtmlInputAspectMember.InferInputType(acessor.DataType) : hia.InputType,
                    hia.OptionSource == null && acessor.DataType.IsEnum ? new HtmlInputOptionEnum(acessor.DataType) : null,
                    InterceptorAspect <T> .Instance.GetMemberOrDefault(acessor.Name),
                    RestrictionAspect <T> .Instance.GetMemberOrDefault(acessor.Name),
                    GlobalizationAspect <T> .Instance.GetMemberOrDefault(acessor.Name));

                return(true);
            }
        }
 public XmlAspectMemberAttribute(ClassAcessor acessor, string localName, bool mandatory, SimpleAdapter adapter)
     : base(acessor, localName, mandatory)
 {
     this._Adapter = adapter;
 }
Ejemplo n.º 15
0
 protected override bool CreateAspectFor(ClassAcessor acessor, out InterceptorAspectMember member)
 {
     member = new InterceptorAspectMember(acessor);
     return(member.HasInterceptors);
 }
Ejemplo n.º 16
0
 public RestrictionAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._restrictions = new RestrictionList(this);
 }
Ejemplo n.º 17
0
 protected override bool CreateAspectFor(ClassAcessor acessor, out CompositeAnnotationMember <TMemberAspect> member)
 {
     member = new CompositeAnnotationMember <TMemberAspect>(acessor, acessor.GetAttributes <TMemberAspect>(true));
     return(member.Annotations.Count > 0);
 }
Ejemplo n.º 18
0
 protected override bool CreateAspectFor(ClassAcessor acessor, out GeneratorAspectMember member)
 {
     member = new GeneratorAspectMember(acessor);
     return(member.Generator != null);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Creates a new aspec for a member accessor.
 /// </summary>
 /// <param name="acessor">The member accessor.</param>
 /// <param name="member">The member instance to create.</param>
 /// <returns>True if it's validated and created.</returns>
 protected abstract bool CreateAspectFor(ClassAcessor acessor, out TMember member);
 public GeneratorAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._generator = GetAttribute<Generator>(true);
 }
 protected override bool CreateAspectFor(ClassAcessor acessor, out RestrictionAspectMember member)
 {
     member = new RestrictionAspectMember(acessor);
     return(member.HasRestrictions);
 }
 public RestrictionAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._restrictions = new RestrictionList(this);
 }
 public GeneratorAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._generator = GetAttribute <Generator>(true);
 }
Ejemplo n.º 24
0
        public static HtmlComposite GenerateHtmlTree <T>(Tree <T> tree, string identityPrefix, ClassAcessor identityMember)
        {
            HtmlComposite ul = new HtmlComposite("ul");

            foreach (TreeNode <T> child in tree)
            {
                ul.Children.AddLast(GenerateHtmlTreeNode <T>(child, identityPrefix, identityMember));
            }
            return(ul);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Constructs the aspect member.
 /// </summary>
 /// <param name="acessor">The class acessor to use.</param>
 public AspectMember(ClassAcessor acessor)
 {
     this._Acessor = acessor;
 }
Ejemplo n.º 26
0
        public static HtmlComposite GenerateHtmlTreeNode <T>(EixoX.Collections.TreeNode <T> treeNode, string identityPrefix, ClassAcessor identityMember)
        {
            HtmlComposite li = new HtmlComposite("li");

            if (identityMember != null)
            {
                li.Attributes.AddLast("id", identityPrefix + identityMember.GetValue(treeNode.Value));
            }

            li.Children.AddLast(new HtmlSimple("span", treeNode.Value));

            if (treeNode.Count > 0)
            {
                li.Children.AddLast(GenerateHtmlTree <T>(treeNode, identityPrefix, identityMember));
            }

            return(li);
        }
 public InterceptorAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._interceptors = new InterceptorList(this);
 }
 public XmlAspectMemberComposite(ClassAcessor acessor, string localName, bool mandatory, XmlAspect aspect, ConstructorInfo constructor)
     : base(acessor, localName, mandatory)
 {
     this._Aspect = aspect;
     this._Constructor = constructor;
 }
Ejemplo n.º 29
0
 public GlobalizationAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._Terms = new GlobalizationList();
 }
Ejemplo n.º 30
0
        protected override bool CreateAspectFor(ClassAcessor acessor, out XmlAspectMember member)
        {
            XmlAttribute xa = acessor.GetAttribute <XmlAttribute>(true);

            if (xa == null)
            {
                member = null;
                return(false);
            }
            else
            {
                SimpleAdapter adapter = SimpleAdapters.CreateInstance(
                    acessor.DataType,
                    xa.FormatString,
                    string.IsNullOrEmpty(xa.Culture) ? null :
                    CultureInfo.GetCultureInfo(xa.Culture)
                    );

                if (adapter != null)
                {
                    switch (xa.XmlType)
                    {
                    case XmlType.Attribute:
                        member = new XmlAspectMemberAttribute(
                            acessor,
                            string.IsNullOrEmpty(xa.Name) ? acessor.Name : xa.Name,
                            xa.IsMandatory,
                            adapter);
                        return(true);

                    case XmlType.CDATA:
                        member = new XmlAspectMemberCDATA(
                            acessor,
                            string.IsNullOrEmpty(xa.Name) ? acessor.Name : xa.Name,
                            xa.IsMandatory,
                            adapter);
                        return(true);

                    case XmlType.Element:
                        member = new XmlAspectMemberText(
                            acessor,
                            string.IsNullOrEmpty(xa.Name) ? acessor.Name : xa.Name,
                            xa.IsMandatory,
                            adapter);
                        return(true);

                    default:
                        throw new NotImplementedException("Unable to serialize primitive type with " + xa.XmlType);
                    }
                }
                else if (typeof(IList).IsAssignableFrom(acessor.DataType))
                {
                    member = new XmlAspectMemberList(
                        acessor,
                        string.IsNullOrEmpty(xa.Name) ? acessor.Name : xa.Name,
                        xa.IsMandatory);
                    return(true);
                }
                else
                {
                    member = new XmlAspectMemberComposite(
                        acessor,
                        string.IsNullOrEmpty(xa.Name) ? acessor.Name : xa.Name,
                        xa.IsMandatory,
                        GetInstance(acessor.DataType),
                        acessor.DataType.GetConstructor(Type.EmptyTypes));
                }

                return(true);
            }
        }
Ejemplo n.º 31
0
 public InterceptorAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._interceptors = new InterceptorList(this);
 }
 public SingleAnnotationAspectMember(ClassAcessor acessor, TMemberAspect value)
     : base(acessor)
 {
     this._Annotation = value;
 }
 public GlobalizationAspectMember(ClassAcessor acessor)
     : base(acessor)
 {
     this._Terms = new GlobalizationList();
 }
Ejemplo n.º 34
0
 public XmlAspectMember(ClassAcessor acessor, string localName, bool mandatory)
     : base(acessor)
 {
     this._LocalName = localName;
     this._Mandatory = mandatory;
 }
 public XmlAspectMemberComposite(ClassAcessor acessor, string localName, bool mandatory, XmlAspect aspect, ConstructorInfo constructor)
     : base(acessor, localName, mandatory)
 {
     this._Aspect      = aspect;
     this._Constructor = constructor;
 }
Ejemplo n.º 36
0
 public XmlAspectMemberAttribute(ClassAcessor acessor, string localName, bool mandatory, SimpleAdapter adapter)
     : base(acessor, localName, mandatory)
 {
     this._Adapter = adapter;
 }
Ejemplo n.º 37
0
 protected override bool CreateAspectFor(ClassAcessor acessor, out GlobalizationAspectMember member)
 {
     member = new GlobalizationAspectMember(acessor);
     return(true);
 }
Ejemplo n.º 38
0
 public XmlAspectMember(ClassAcessor acessor, string localName, bool mandatory)
     : base(acessor)
 {
     this._LocalName = localName;
     this._Mandatory = mandatory;
 }
Ejemplo n.º 39
0
 public CompositeAnnotationMember(ClassAcessor acessor, IEnumerable <TMemberAspect> values)
     : base(acessor)
 {
     this._Annotations = new LinkedList <TMemberAspect>(values);
 }