Пример #1
0
        static Property CreatePropertyObject(PropertyInfo myProperty, int orderIndexOfPropertyItem)
        {
            var isTrueType  = true;
            var isFalseType = false;
            var result      = new Property();

            // var mydbType = FindType(Type.GetType(myProperty.PropertyType.ToString()));
            var mydbType = Type.GetType(myProperty.PropertyType.ToString()).ToDbType();

            var databaseColumnName = myProperty.Name;
            var databaseColumnType = Convert.ToString(mydbType);;

            var myPropertyType = myProperty.PropertyType;

            if (myPropertyType == typeof(DateTime?))
            {
                result = new DateTimeProperty
                {
                    HasTime  = !Attribute.IsDefined(myProperty, typeof(DateOnlyAttribute)),
                    HasDate  = true,
                    TimeOnly = myProperty.PropertyType == typeof(TimeSpan) ? isTrueType : isFalseType,
                };
            }
            else if (Type.GetType(myProperty.PropertyType.ToString()).IsNumericType())
            {
                result = new NumberProperty
                {
                    IsAutoNumber          = Attribute.IsDefined(myProperty, typeof(AutoNumberAttribute)),
                    SpecifiedPropertyType = myProperty.PropertyType.ToString(),
                };
            }
            else if (myPropertyType == typeof(string))
            {
                result = new StringProperty
                {
                    IsRowVersion = myProperty.PropertyType == typeof(byte) ? isTrueType : isFalseType,
                };
            }
            else if (Attribute.IsDefined(myProperty, typeof(CalculatedAttribute)) == false &&
                     myProperty.IsAccociation())
            {
                result = ObjectDataProvider.GetAssosciationObject(myProperty);
            }
            else if (myPropertyType == typeof(Blob))
            {
                result             = new BinaryProperty();
                databaseColumnName = myProperty.Name + "_FileName";
                databaseColumnType = DbType.String.ToString();
            }

            result.EntityType = GetSmallEntityType(myProperty.ReflectedType);
            result.Initialize(myProperty, databaseColumnName, databaseColumnType, mydbType, orderIndexOfPropertyItem);

            return(result);
        }
 public void Visit(BinaryProperty mapping)
 {
     Increment("binary");
 }
Пример #3
0
		public virtual void Visit(BinaryProperty property) { }
Пример #4
0
		public virtual void Visit(BinaryProperty mapping)
		{
		}
        public VertexTypePredefinition ToVertexTypePredefinition()
        {
            VertexTypePredefinition VertexTypePreDef = new VertexTypePredefinition(this.VertexTypeName);

            if (this.IsAbstract)
            {
                VertexTypePreDef.MarkAsAbstract();
            }
            if (this.IsSealed)
            {
                VertexTypePreDef.MarkAsSealed();
            }

            VertexTypePreDef.SetComment(this.Comment);
            VertexTypePreDef.SetSuperTypeName(this.SuperVertexTypeName);

            if (this.Properties != null)
            {
                foreach (var Property in this.Properties)
                {
                    VertexTypePreDef.AddProperty(Property.ToPropertyPredefinition());
                }
            }

            if (this.BinaryProperties != null)
            {
                foreach (var BinaryProperty in this.BinaryProperties)
                {
                    VertexTypePreDef.AddBinaryProperty(BinaryProperty.ToBinaryPropertyPredefinition());
                }
            }

            if (this.Uniques != null)
            {
                foreach (var Unique in this.Uniques)
                {
                    VertexTypePreDef.AddUnique(Unique.ToUniquePredefinition());
                }
            }

            if (this.IncomingEdges != null)
            {
                foreach (var IncomingEdge in this.IncomingEdges)
                {
                    VertexTypePreDef.AddIncomingEdge(IncomingEdge.ToIncomingEdgePredefinition());
                }
            }

            if (this.OutgoingEdges != null)
            {
                foreach (var OutgoingEdge in this.OutgoingEdges)
                {
                    VertexTypePreDef.AddOutgoingEdge(OutgoingEdge.ToOutgoingEdgePredefinition());
                }
            }

            if (this.Indices != null)
            {
                foreach (var Index in this.Indices)
                {
                    VertexTypePreDef.AddIndex(Index.ToIndexPredefinition());
                }
            }
            return(VertexTypePreDef);
        }