Esempio n. 1
0
        /// <inheritdoc />
        public virtual string GetMethodChain(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");
            Debug.Assert(Name != null || TypeName != null || Order != null, "Name, TypeName & Order are null.");

            var builder = new StringBuilder();

            if (Name != null)
            {
                builder.Append(".HasColumnName(");
                builder.Append(code.Literal(Name));
                builder.Append(")");
            }

            if (Order.HasValue)
            {
                builder.Append(".HasColumnOrder(");
                builder.Append(code.Literal(Order.Value));
                builder.Append(")");
            }

            if (TypeName != null)
            {
                builder.Append(".HasColumnType(");
                builder.Append(code.Literal(TypeName));
                builder.Append(")");
            }

            return(builder.ToString());
        }
        /// <inheritdoc />
        public virtual string GetMethodChain(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");
            Debug.Assert(!string.IsNullOrEmpty(Table), "Table is null or empty.");

            return(".ToTable(" + code.Literal(GetName()) + ")");
        }
        /// <inheritdoc />
        public virtual string GetMethodChain(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");
            Debug.Assert(
                Table != null || _leftKeys.Any() || _rightKeys.Any(),
                "Table is null and _leftKeys and _rightKeys are empty.");

            var builder = new StringBuilder();

            builder.Append(".Map(");
            builder.Append(code.BeginLambda("m"));
            builder.Append("m");

            if (Table != null)
            {
                builder.Append(".ToTable(");
                builder.Append(code.Literal(Table));

                if (Schema != null)
                {
                    builder.Append(", ");
                    builder.Append(code.Literal(Schema));
                }

                builder.Append(")");
            }

            if (_leftKeys.Count != 0)
            {
                builder.Append(".MapLeftKey(");
                builder.Append(code.Literal(_leftKeys));
                builder.Append(")");
            }

            if (_rightKeys.Count != 0)
            {
                builder.Append(".MapRightKey(");
                builder.Append(code.Literal(_rightKeys));
                builder.Append(")");
            }

            builder.Append(")");

            return(builder.ToString());
        }
Esempio n. 4
0
        /// <inheritdoc />
        public virtual string GetAttributeBody(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");
            Debug.Assert(Name != null || TypeName != null || Order != null, "Name, TypeName & Order are null.");

            var builder = new StringBuilder();

            builder.Append("Column(");

            if (Name != null)
            {
                builder.Append(code.Literal(Name));
            }

            if (Order.HasValue)
            {
                if (Name != null)
                {
                    builder.Append(", ");
                }

                builder.Append("Order");
                builder.Append(code.NamedParameterSetter);
                builder.Append(code.Literal(Order.Value));
            }

            if (TypeName != null)
            {
                if (Name != null || Order.HasValue)
                {
                    builder.Append(", ");
                }

                builder.Append("TypeName");
                builder.Append(code.NamedParameterSetter);
                builder.Append(code.Literal(TypeName));
            }

            builder.Append(")");

            return(builder.ToString());
        }
Esempio n. 5
0
        /// <inheritdoc />
        public virtual string GetMethodChain(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");

            var builder = new StringBuilder();

            builder.Append(".WillCascadeOnDelete(");

            if (DeleteBehavior != OperationAction.Cascade)
            {
                Debug.Assert(DeleteBehavior == OperationAction.None, "DeleteBehavior is not None.");

                builder.Append(code.Literal(false));
            }

            builder.Append(")");

            return(builder.ToString());
        }
Esempio n. 6
0
        /// <inheritdoc />
        public virtual string GetMethodChain(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");

            return(".HasMaxLength(" + code.Literal(MaxLength) + ")");
        }
Esempio n. 7
0
        /// <inheritdoc />
        public virtual string GetAttributeBody(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");

            return("MaxLength(" + code.Literal(MaxLength) + ")");
        }
Esempio n. 8
0
        /// <inheritdoc />
        public virtual string GetMethodChain(CodeHelper code)
        {
            Debug.Assert(code != null, "code is null.");

            return(".HasPrecision(" + code.Literal(Precision) + ")");
        }