Exemple #1
0
        /// <summary>
        /// Converts this instance to the class specified
        /// </summary>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="mapping">The mapping.</param>
        /// <returns>The resulting property</returns>
        public override IProperty Convert <TResult>(IMapping mapping)
        {
            var Result       = new ExpressionTypeConverter <ClassType, DataType>(Expression).Convert <TResult>();
            var ReturnObject = new Reference <TResult, DataType>(Result, mapping);

            if (Index)
            {
                ReturnObject.IsIndexed();
            }

            if (ReadOnly)
            {
                ReturnObject.IsReadOnly();
            }

            if (Unique)
            {
                ReturnObject.IsUnique();
            }

            ReturnObject.WithColumnName(ColumnName);
            ReturnObject.WithComputedColumnSpecification(ComputedColumnSpecification);
            for (int x = 0, ConstraintsCount = Constraints.Count; x < ConstraintsCount; x++)
            {
                var Constraint = Constraints[x];
                ReturnObject.WithConstraint(Constraint);
            }

            ReturnObject.WithDefaultValue(DefaultValue);
            ReturnObject.WithMaxLength(MaxLength);
            return(ReturnObject);
        }
Exemple #2
0
        /// <summary>
        /// Converts this instance to the class specified
        /// </summary>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="mapping">The mapping.</param>
        /// <returns>The resulting property</returns>
        public override IMapProperty Convert <TResult>(IMapping mapping)
        {
            var Result       = new ExpressionTypeConverter <ClassType, DataType>(Expression).Convert <TResult>();
            var ReturnObject = new Map <TResult, DataType>(Result, mapping);

            if (Cascade)
            {
                ReturnObject.CascadeChanges();
            }

            if (LoadPropertyQuery != null)
            {
                ReturnObject.LoadUsing(LoadPropertyQuery.QueryString, LoadPropertyQuery.DatabaseCommandType);
            }

            return(ReturnObject);
        }
Exemple #3
0
        /// <summary>
        /// Converts this instance to the class specified
        /// </summary>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="mapping">The mapping.</param>
        /// <returns>The resulting property</returns>
        public override IManyToManyProperty Convert <TResult>(IMapping mapping)
        {
            var Result       = new ExpressionTypeConverter <ClassType, IList <DataType> >(Expression).Convert <TResult>();
            var ReturnObject = new ManyToMany <TResult, DataType>(Result, mapping);

            if (Cascade)
            {
                ReturnObject.CascadeChanges();
            }

            if (LoadPropertyQuery != null)
            {
                ReturnObject.LoadUsing(LoadPropertyQuery.QueryString, LoadPropertyQuery.DatabaseCommandType);
            }

            if (!string.IsNullOrEmpty(TableName))
            {
                ReturnObject.SetTableName(TableName);
            }

            return(ReturnObject);
        }
Exemple #4
0
        /// <summary>
        /// Converts this instance to the class specified
        /// </summary>
        /// <typeparam name="TResult">The type of the result.</typeparam>
        /// <param name="mapping">The mapping.</param>
        /// <returns>The resulting property</returns>
        public override IManyToOneProperty Convert <TResult>(IMapping mapping)
        {
            var Result       = new ExpressionTypeConverter <TClassType, TDataType>(Expression).Convert <TResult>();
            var ReturnObject = new ManyToOneSingle <TResult, TDataType>(Result, mapping);

            if (Cascade)
            {
                ReturnObject.CascadeChanges();
            }

            if (LoadPropertyQuery != null)
            {
                ReturnObject.LoadUsing(LoadPropertyQuery.QueryString, LoadPropertyQuery.DatabaseCommandType);
            }

            if (!string.IsNullOrEmpty(ColumnName))
            {
                ReturnObject.SetColumnName(ColumnName);
            }

            return(ReturnObject);
        }