public Class CreateRecordClass()
        {
            var t = this.Table;
            var c = new Class(AccessModifier.Public, "Record");

            c.Modifier.Partial = true;
            c.BaseClass        = new TypeName("TableRecord<Record>");
            c.ImplementInterfaces.Add(new TypeName("IRecord"));

            c.Constructors.Add(CreateDefaultConstructor());
            c.Constructors.Add(CreateConstructor());

            c.Methods.Add(CreateGetTableNameMethod());
            c.Methods.Add(new Method(MethodAccessModifier.Partial, "ConstructorExecuted"));
            c.Methods.Add(CreateSetPropertyMethod());
            c.Methods.Add(CreateSetPropertyMethod1());
            c.Methods.Add(CreateCompareAllColumnMethod());
            c.Methods.Add(CreateComparePrimaryKeyColumnMethod());
            c.Methods.Add(CreateGetValueMethod());
            c.Methods.Add(CreateSetValueMethod());
            c.Methods.Add(CreateGetColumnCountMethod());

            if (t.Columns.Exists(el => el.Name == "SaveMode") == false)
            {
                c.Properties.Add(CreateSaveModeProperty());
            }
            ClassSourceCodeFileFactory.AddPropertyAndField(c, t.Columns);

            return(c);
        }
        public Class CreateClass()
        {
            Class c = new Class(AccessModifier.Public, "Record");

            c.Modifier.Partial = true;
            c.BaseClass        = new TypeName("UserDefinedTableTypeRecord");

            ClassSourceCodeFileFactory.AddPropertyAndField(c, this.UserDefinedTableType.Columns);

            c.Constructors.Add(new Constructor(AccessModifier.Public, "Record"));
            c.Methods.Add(this.CreateGetValuesMethod());

            return(c);
        }
        public Class CreateClass()
        {
            Class c = new Class(AccessModifier.Public, this.ResultSet.Name);

            c.Modifier.Partial = true;
            c.BaseClass        = new TypeName(String.Format("StoredProcedureResultSet", this.StoredProcedureName));
            if (String.IsNullOrEmpty(this.ResultSet.TableName) == false)
            {
                c.ImplementInterfaces.Add(new TypeName(this.ResultSet.TableName + ".IRecord"));
            }

            ClassSourceCodeFileFactory.AddPropertyAndField(c, this.ResultSet.Columns);

            c.Constructors.Add(new Constructor(AccessModifier.Public, this.ResultSet.Name));
            c.Constructors.Add(CreateResultSetConstructor());
            c.Constructors.Add(CreateResultSetConstructorWithStoredProcedure());

            c.Methods.Add(CreateResultSetToStringMethod());

            return(c);
        }
        public Class CreateClass()
        {
            var   sp = this.StoredProcedure;
            Class c  = new Class(AccessModifier.Public, sp.Name);
            StoredProcedureResultSetColumn rs = null;

            c.Modifier.Partial = true;
            if (sp.ResultSets.Count > 0)
            {
                rs = sp.ResultSets[0];
            }
            if (rs == null)
            {
                c.BaseClass = new TypeName("StoredProcedure");
            }
            else
            {
                if (sp.ResultSets.Count == 1)
                {
                    c.BaseClass = new TypeName(String.Format("StoredProcedureWithResultSet<{0}.{1}>", sp.Name, rs.Name));
                }
                else
                {
                    c.BaseClass = new TypeName(String.Format("StoredProcedureWithResultSetsList<{0}.{1}, {0}.ResultSetsList>", sp.Name, rs.Name));
                }
            }
            c.Fields.Add(CreateNameConstField());

            if (sp.Parameters.Exists(el => el.Name == "DatabaseKey") == false)
            {
                c.Properties.Add(CreateDatabaseKeyProperty());
            }
            if (sp.Parameters.Exists(el => el.Name == "TransactionKey") == false)
            {
                c.Properties.Add(CreateTransactionKeyProperty());
            }

            ClassSourceCodeFileFactory.AddPropertyAndField(c, sp.Parameters);

            c.Constructors.Add(CreateConstructor());

            c.Methods.Add(CreateGetStoredProcedureNameMethod());
            c.Methods.Add(new Method(MethodAccessModifier.Partial, "ConstructorExecuted"));
            c.Methods.Add(CreateCreateCommandMethod());
            c.Methods.Add(CreateSetOutputParameterValueMethod());

            if (rs != null)
            {
                c.Methods.Add(CreateCreateResultSetMethod());

                for (int i = 0; i < sp.ResultSets.Count; i++)
                {
                    if (i == 0)
                    {
                        c.Methods.Add(CreateSetResultSetMethod(sp.ResultSets[i], MethodPolymophism.Override));
                    }
                    else
                    {
                        c.Methods.Add(CreateSetResultSetMethod(sp.ResultSets[i], MethodPolymophism.None));
                    }
                    var f = new ResultSetClassFactory(sp.Name, sp.StoredProcedureType, sp.ResultSets[i]);
                    c.Classes.Add(f.CreateClass());
                }
                if (sp.ResultSets.Count > 1)
                {
                    var f = new ResultSetsListClassFactory(sp);
                    c.Classes.Add(f.CreateClass());

                    c.Methods.Add(CreateGetResultSetsListMethod());
                    c.Methods.Add(CreateGetResultSetsListMethod1());
                }
            }
            c.Methods.Add(CreateToStringMethod());

            return(c);
        }