Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
 }