Example #1
0
        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;
            }
        }
Example #2
0
        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;

            var packWriter = new PackagesWriter(_projectVersion);

            if (RequiresOracleManagedClient)
            {
                packWriter.AddOracleManagedClient();
            }

            //no need to reference NHibernate for HBMs
            switch (_codeWriterSettings.CodeTarget)
            {
            case CodeTarget.PocoNHibernateFluent:
                pw.AddNHibernateReference();
                var packs = packWriter.WriteFluentNHibernate();
                WritePackagesConfig(directory, pw, packs);
                break;

            case CodeTarget.PocoEntityCodeFirst:
            case CodeTarget.PocoRiaServices:
                pw.AddEntityFrameworkReference();
                WritePackagesConfig(directory, pw, packWriter.WriteEntityFramework());
                break;
            }
        }
Example #3
0
        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;
            }
        }