public void GenerateDal(string objectSchema, string objectName, string classNamespace, string dalNamespace, string dalConnectionKey, bool includeInterface) { string className = string.Format("{0}DAL", renameDotNetReservedNames(objectName)); string interfaceName = string.Empty; if (includeInterface) { 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 created.", objectSchema, objectName)); } var dalTemplate = new sql.DAL(objectSchema, objectName, renameDotNetReservedNames(objectName), className, classNamespace, dalNamespace, interfaceName, dalConnectionKey, columns); string classText = dalTemplate.TransformText(); File.WriteAllText(string.Format("{0}\\{1}.Auto.cs", _outputFolder, className), classText); }
public void GenerateDal(string objectSchema, string objectName, string classNamespace, string dalNamespace, string dalConnectionKey, bool includeInterface) { string className = string.Format("{0}DAL", renameDotNetReservedNames(objectName)); string interfaceName = string.Empty; if (includeInterface) 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 created.", objectSchema, objectName)); var dalTemplate = new sql.DAL(objectSchema, objectName, renameDotNetReservedNames(objectName), className, classNamespace, dalNamespace, interfaceName, dalConnectionKey, columns); string classText = dalTemplate.TransformText(); File.WriteAllText(string.Format("{0}\\{1}.Auto.cs", _outputFolder, className), classText); }