Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ISessionFactory CriaConexao()
- {
- try
- {
- if (SessionFactory == null)
- lock (typeof(NHibernateHelper))
- {
- FluentConfiguration configuration = Fluently.Configure()
- .Database(MsSqlConfiguration.MsSql2012.ConnectionString(c => c.FromConnectionStringWithKey("MyConnectionString")
- .ShowSql())
- .Mappings(c => c.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly())).
- configuration.BuildSessionFactory();
- }
- return SessionFactory;
- }
- catch (Exception ex)
- {
- Log.write(ex.ToString());
- throw;
- }
- }
- // {“Valor não pode ser nulo.rnNome do parâmetro: Data Source”
- <?xml version="1.0" encoding="utf-8"?>
- <configuration>
- <configSections>
- </configSections>
- <connectionStrings>
- <add name="MyConnectionString" connectionString="Data Source=CARLOSSQLEXPRESS;Initial Catalog=PAF-ECF;Integrated Security=True"
- providerName="System.Data.SqlClient" />
- </connectionStrings>
- <startup> E:PROJETO C#AutomacaoComercialFrenteCaixaApp.config
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup>
- <runtime>
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
- </configuration>
Add Comment
Please, Sign In to add comment