private void InitMappingProjects(FileSystemInfo directory, ProjectWriter pw) { if (_codeWriterSettings.CodeTarget == CodeTarget.Poco) { return; } var mapping = new DirectoryInfo(Path.Combine(directory.FullName, "Mapping")); if (!mapping.Exists) { mapping.Create(); } _mappingPath = mapping.FullName; //no need to reference NHibernate for HBMs switch (_codeWriterSettings.CodeTarget) { case CodeTarget.PocoNHibernateFluent: pw.AddNHibernateReference(); var packs = _codeWriterSettings.WriteProjectFileNet35 ? PackagesWriter.WriteFluentNHibernateNet35() : PackagesWriter.WriteFluentNHibernateNet4(); WritePackagesConfig(directory, pw, packs); break; case CodeTarget.PocoEntityCodeFirst: case CodeTarget.PocoRiaServices: pw.AddEntityFrameworkReference(); pw.UpgradeTo2010(); //you can only use 2010 WritePackagesConfig(directory, pw, PackagesWriter.WriteEntityFrameworkNet4()); break; } }
private void WriteProjectFile(DirectoryInfo directory, ProjectWriter pw) { var vs2010 = _codeWriterSettings.WriteProjectFile; var vs2008 = _codeWriterSettings.WriteProjectFileNet35; if (IsCodeFirst()) { vs2008 = false; } if (!vs2010 && !vs2008) { return; } var projectName = _codeWriterSettings.Namespace ?? "Project"; if (vs2008) { File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } if (vs2010) { pw.UpgradeTo2010(); if (vs2008) { projectName += ".2010"; } File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } }
/// <summary> /// Creates the project writer, using either 2008 or 2010 format. /// </summary> /// <returns></returns> private ProjectWriter CreateProjectWriter() { var pw = new ProjectWriter(_codeWriterSettings.Namespace); var vs2010 = _codeWriterSettings.WriteProjectFile; var vs2008 = _codeWriterSettings.WriteProjectFileNet35; if (IsCodeFirst()) { vs2010 = true; } //you can specify 2008 AND 2010. if (vs2010 && !vs2008) { pw.UpgradeTo2010(); } return(pw); }
private void WriteProjectFile(DirectoryInfo directory, ProjectWriter pw) { if (_codeWriterSettings.CodeTarget == CodeTarget.PocoEfCore) { //for Core we might be project.json. //Even for csproj Nuget restore is too complex so skip this. return; } var vs2010 = _codeWriterSettings.WriteProjectFile; var vs2008 = _codeWriterSettings.WriteProjectFileNet35; if (IsCodeFirst()) { vs2008 = false; } if (!vs2010 && !vs2008) { return; } var projectName = _codeWriterSettings.Namespace ?? "Project"; if (vs2008) { File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } if (vs2010) { pw.UpgradeTo2010(); if (vs2008) { projectName += ".2010"; } File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } }
private void WriteProjectFile(DirectoryInfo directory, ProjectWriter pw) { if (!_codeWriterSettings.WriteProjectFile) { return; } var projectName = _codeWriterSettings.Namespace ?? "Project"; File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); if (IsCodeFirst()) { return; } //EF CodeFirst is already .Net 4 pw.UpgradeTo2010(); File.WriteAllText( Path.Combine(directory.FullName, projectName + ".2010.csproj"), pw.Write()); }
private void WriteProjectFile(DirectoryInfo directory, ProjectWriter pw) { if (_codeWriterSettings.CodeTarget == CodeTarget.PocoEfCore) { //for Core we might be project.json. //Even for csproj Nuget restore is too complex so skip this. return; } var vs2010 = _codeWriterSettings.WriteProjectFile; var vs2008 = _codeWriterSettings.WriteProjectFileNet35; if (IsCodeFirst()) vs2008 = false; if (!vs2010 && !vs2008) return; var projectName = _codeWriterSettings.Namespace ?? "Project"; if (vs2008) { File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } if (vs2010) { pw.UpgradeTo2010(); if (vs2008) projectName += ".2010"; File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } }
private void InitMappingProjects(FileSystemInfo directory, ProjectWriter pw) { if (_codeWriterSettings.CodeTarget == CodeTarget.Poco) return; var mapping = new DirectoryInfo(Path.Combine(directory.FullName, "Mapping")); if (!mapping.Exists) mapping.Create(); _mappingPath = mapping.FullName; //no need to reference NHibernate for HBMs switch (_codeWriterSettings.CodeTarget) { case CodeTarget.PocoNHibernateFluent: pw.AddNHibernateReference(); var packs = _codeWriterSettings.WriteProjectFileNet35 ? PackagesWriter.WriteFluentNHibernateNet35() : PackagesWriter.WriteFluentNHibernateNet4(); WritePackagesConfig(directory, pw, packs); break; case CodeTarget.PocoEntityCodeFirst: case CodeTarget.PocoRiaServices: pw.AddEntityFrameworkReference(); pw.UpgradeTo2010(); //you can only use 2010 WritePackagesConfig(directory, pw, PackagesWriter.WriteEntityFrameworkNet4()); break; } }
/// <summary> /// Creates the project writer, using either 2008 or 2010 format. /// </summary> /// <returns></returns> private ProjectWriter CreateProjectWriter() { var pw = new ProjectWriter(_codeWriterSettings.Namespace); var vs2010 = _codeWriterSettings.WriteProjectFile; var vs2008 = _codeWriterSettings.WriteProjectFileNet35; if (IsCodeFirst()) vs2010 = true; //you can specify 2008 AND 2010. if (vs2010 && !vs2008) pw.UpgradeTo2010(); return pw; }
private void WriteProjectFile(DirectoryInfo directory, ProjectWriter pw) { var vs2010 = _codeWriterSettings.WriteProjectFile; var vs2008 = _codeWriterSettings.WriteProjectFileNet35; if (IsCodeFirst()) vs2008 = false; if (!vs2010 && !vs2008) return; var projectName = _codeWriterSettings.Namespace ?? "Project"; if (vs2008) { File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } if (vs2010) { pw.UpgradeTo2010(); if (vs2008) projectName += ".2010"; File.WriteAllText( Path.Combine(directory.FullName, projectName + ".csproj"), pw.Write()); } }