Ejemplo n.º 1
0
        /// <summary>
        /// Builds arguments for a SchemaObjectConstructor for a given specification level
        /// </summary>
        /// <param name="obj">SchemaObject to be constructed</param>
        /// <param name="specification">Level at which object is to be specified</param>
        /// <returns>String representing constructor arguments</returns>
        private static string BuildSchemaObjectCSV(SchemaObject obj, SchemaObjectSpecificationLevel specification)
        {
            switch (specification)
            {
            case SchemaObjectSpecificationLevel.Catalog:
                return(string.Format(CultureInfo.InvariantCulture, "\"{0}\", \"{1}\", \"{2}\"", obj.Catalog, obj.Schema, obj.Name));

            case SchemaObjectSpecificationLevel.Schema:
                return(string.Format(CultureInfo.InvariantCulture, "\"{0}\", \"{1}\"", obj.Schema, obj.Name));

            default:
                return(string.Format(CultureInfo.InvariantCulture, "\"{0}\"", obj.Name));
            }
        }
 /// <summary>
 /// Initializes a new instance of the CSharpDatabaseSchemaSerializer class to write to a given TextWriter
 /// </summary>
 /// <param name="writer">The TextWriter to write C# code to</param>
 /// <param name="typeConstructorGenerator">Code generator to use for type creation</param>
 /// <param name="specification">Level of specification to be used constructing SchemaObjects in the generated code</param>
 public CSharpDatabaseSchemaSerializer(SafeIndentedTextWriter writer, IDataTypeConstructorCodeGenerator typeConstructorGenerator, SchemaObjectSpecificationLevel specification)
 {
     this.Writer = writer;
     this.TypeConstructorGenerator = typeConstructorGenerator;
     this.SpecificationLevel = specification;
 }
        /// <summary>
        /// Builds arguments for a SchemaObjectConstructor for a given specification level
        /// </summary>
        /// <param name="obj">SchemaObject to be constructed</param>
        /// <param name="specification">Level at which object is to be specified</param>
        /// <returns>String representing constructor arguments</returns>
        private static string BuildSchemaObjectCSV(SchemaObject obj, SchemaObjectSpecificationLevel specification)
        {
            switch (specification)
            {
                case SchemaObjectSpecificationLevel.Catalog:
                    return string.Format(CultureInfo.InvariantCulture, "\"{0}\", \"{1}\", \"{2}\"", obj.Catalog, obj.Schema, obj.Name);

                case SchemaObjectSpecificationLevel.Schema:
                    return string.Format(CultureInfo.InvariantCulture, "\"{0}\", \"{1}\"", obj.Schema, obj.Name);

                default:
                    return string.Format(CultureInfo.InvariantCulture, "\"{0}\"", obj.Name);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the CSharpDatabaseSchemaSerializer class to write to a given TextWriter
 /// </summary>
 /// <param name="writer">The TextWriter to write C# code to</param>
 /// <param name="typeConstructorGenerator">Code generator to use for type creation</param>
 /// <param name="specification">Level of specification to be used constructing SchemaObjects in the generated code</param>
 public CSharpDatabaseSchemaSerializer(SafeIndentedTextWriter writer, IDataTypeConstructorCodeGenerator typeConstructorGenerator, SchemaObjectSpecificationLevel specification)
 {
     this.Writer = writer;
     this.TypeConstructorGenerator = typeConstructorGenerator;
     this.SpecificationLevel       = specification;
 }