コード例 #1
0
ファイル: Generator.cs プロジェクト: gbhl/bhl-us-tools
        public void GenerateDalInterface(string classNamespace, string interfaceNamespace, string objectSchema, string objectName)
        {
            string className            = string.Format("{0}DAL", renameDotNetReservedNames(objectName));
            string interfaceName        = string.Format("I{0}", className);
            List <sql.DBColumn> columns = new sql.DataAccess(_connectionString).GetColumns(
                objectSchema, objectName, _columnLanguageTypeValues, _columnDataProviderTypeValues);

            if (!HasPrimaryKey(columns))
            {
                throw new NoPrimaryKeyException(string.Format("{0}.{1} has no primary key.  No DAL interface created.", objectSchema, objectName));
            }
            var    interfaceTemplate = new sql.DALInterface(objectSchema, renameDotNetReservedNames(objectName), columns, classNamespace, interfaceNamespace, interfaceName);
            string interfaceText     = interfaceTemplate.TransformText();

            File.WriteAllText(string.Format("{0}\\{1}.Auto.cs", _outputFolder, interfaceName), interfaceText);
        }
コード例 #2
0
ファイル: Generator.cs プロジェクト: gbhl/bhl-us-tools
 public void GenerateDalInterface(string classNamespace, string interfaceNamespace, string objectSchema, string objectName)
 {
     string className = string.Format("{0}DAL", renameDotNetReservedNames(objectName));
     string interfaceName = string.Format("I{0}", className);
     List<sql.DBColumn> columns = new sql.DataAccess(_connectionString).GetColumns(
         objectSchema, objectName, _columnLanguageTypeValues, _columnDataProviderTypeValues);
     if (!HasPrimaryKey(columns)) throw new NoPrimaryKeyException(string.Format("{0}.{1} has no primary key.  No DAL interface created.", objectSchema, objectName));
     var interfaceTemplate = new sql.DALInterface(objectSchema, renameDotNetReservedNames(objectName), columns, classNamespace, interfaceNamespace, interfaceName);
     string interfaceText = interfaceTemplate.TransformText();
     File.WriteAllText(string.Format("{0}\\{1}.Auto.cs", _outputFolder, interfaceName), interfaceText);
 }