public GeneratedTableGateway(string rootNamespace, string providerType, Table table)
            : base(rootNamespace, providerType, table)
        {
            m_Table = table;
            string pkType = PK_PARAMETER_TYPE_LIST;

            // TODO: Remove following code if removing IGateway is the right choice
            /*
            if (!string.IsNullOrEmpty(pkType))
            {
                this.SUBCLASS_NAME = "IGateway<#CLASS_NAME_PREFIX#DataObject,"
                    + PK_PARAMETER_TYPE_LIST
                    + ">";
            }
            else
            {
                this.SUBCLASS_NAME = "IGateway<#CLASS_NAME_PREFIX#DataObject,int>";
            }
            */
        }
 public GeneratedTableDataObject(string rootNamespace, string providerType, Table table)
     : base(rootNamespace, providerType, table)
 {
     m_Table = table;
     this.SUBCLASS_NAME = "I#CLASS_NAME#, IFieldValues";
 }
예제 #3
0
 public Index()
 {
     m_Name = "";
     m_ParentTable = null;
     m_ColumnList = new List<Column>();
 }
        private string GenerateTableDataGatewayUserClass(string projectNamespace, string projectDirectory, string providerType, Table table)
        {
            string fullFileName;
            string fileContents;
            string errorMessage;
            string includeFile;

            try
            {

                UserTableGateway userGateway =
                    new UserTableGateway(projectNamespace, providerType, table);

                fullFileName = projectDirectory + "UserGateway\\Tables\\" + userGateway.CLASS_NAME + ".cs";

                if (!File.Exists(fullFileName))
                {

                    fileContents = userGateway.ToString();

                    File.WriteAllText(fullFileName, fileContents);

                }

                includeFile = "\t\t<Compile Include=\"UserGateway\\Tables\\" + userGateway.CLASS_NAME + ".cs" + "\" />";

            }
            catch (Exception exp)
            {
                errorMessage = "Error while creating the user file for table - " + table.Name + Environment.NewLine;
                errorMessage += "Internal error message:\n";
                errorMessage += exp.Message;

                throw new Exception(errorMessage, exp);
            }

            return includeFile;
        }
        private string GenerateTableDataGatewayGeneratedClass(string projectNamespace, string projectDirectory, string providerType, Table table)
        {
            string fullFileName;
            string fileContents;
            string errorMessage;
            string includeFile;

            try
            {

                GeneratedTableGateway generatedGateway =
                    new GeneratedTableGateway(projectNamespace, providerType, table);

                fullFileName = projectDirectory + "GeneratedClasses\\Gateway\\Tables\\" + generatedGateway.FILE_NAME;

                fileContents = generatedGateway.ToString();
                File.WriteAllText(fullFileName, fileContents);

                includeFile = "\t\t<Compile Include=\"GeneratedClasses\\Gateway\\Tables\\" + generatedGateway.FILE_NAME + "\" />";

            }
            catch (Exception exp)
            {
                errorMessage = "Error while creating the generated file for table - " + table.Name + Environment.NewLine;
                errorMessage += "Internal error message:\n";
                errorMessage += exp.Message;

                throw new Exception(errorMessage, exp);
            }

            return includeFile;
        }
        private string GenerateTableDataEntityGeneratedClass(string projectNamespace, string projectDirectory, string providerType, Table table)
        {
            string fullFileName;
            string fileContents;
            string errorMessage;
            string includeFile;

            try
            {

                GeneratedTableDataObject dataObjectGenerator = new GeneratedTableDataObject(projectNamespace, providerType, table);

                fullFileName = projectDirectory + "GeneratedClasses\\DataObject\\" + dataObjectGenerator.CLASS_NAME + "_Generated.cs";

                fileContents = dataObjectGenerator.ToString();
                File.WriteAllText(fullFileName, fileContents);

                includeFile = "\t\t<Compile Include=\"GeneratedClasses\\DataObject\\" + dataObjectGenerator.CLASS_NAME + "_Generated.cs" + "\" />";

            }
            catch (Exception exp)
            {
                errorMessage = "Error while creating the data object file for table - " + table.Name + Environment.NewLine;
                errorMessage += "Internal error message:\n";
                errorMessage += exp.Message;

                throw new Exception(errorMessage, exp);
            }

            return includeFile;
        }