Hi Again!

   i try to put the ar config in code, my system has a complex
configuration for DB,
so when i using web.config this working.

obs: 2 databases;

in We.bConfig
**********************
        <connectionStrings>
    <add name="comSQLServer" connectionString="Password=XXXX;Persist
Security Info=True;User ID=userXXXX;Initial Catalog=MyDB;Data
Source=ServerDb1;Min Pool Size=5;Max Pool Size=100;Connect
Timeout=60;"/>
                <add name="CASQLServer" connectionString="Password=XXXX;Persist
Security Info=True;User ID=userXXXX;Initial Catalog=PRD_SERVER01;Data
Source= ServerDb1;Min Pool Size=5;Max Pool Size=100;Connect
Timeout=60;"/-->
        </connectionStrings>
  <activerecord isWeb="true" debug="true"
threadinfotype="Castle.ActiveRecord.Framework.Scopes.HybridWebThreadScopeInfo,
Castle.ActiveRecord">
      <config>
                        <add key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
                        <add key="dialect" 
value="NHibernate.Dialect.MsSql2000Dialect"/>
                        <add key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
                        <add key="connection.connection_string_name" 
value="comSQLServer"/>
                </config>
                <config
type="ControleAcesso.Model.Domains.ControleAcessoBaseModel`1,
ControleAcesso.Model">
                        <add key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
                        <add key="dialect" 
value="NHibernate.Dialect.MsSql2000Dialect"/>
                        <add key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
                        <add key="connection.connection_string_name" 
value="CASQLServer"/>
                </config>
        </activerecord>
**********************

in Global.Asax
**********************
            Assembly[] asms = {
                                  Assembly.Load("Sof.Log"), //
Exceller Log
                                  Assembly.Load
("Exceller.Context"), // Contexto do Exceller
                                  Assembly.Load
("ChatManager.Model"), // Chat
                                  Assembly.Load
("ControleAcesso.Model"), // Controle de Acesso
                              };
            ActiveRecordStarter.Initialize(asms,
ActiveRecordSectionHandler.Instance); // Start AR
**********************

only Global.asax
**********************
InPlaceConfigurationSource source = new InPlaceConfigurationSource
            {
                IsRunningInWebApp = true,
                VerifyModelsAgainstDBSchema = true
            };


            source.Add(typeof(ActiveRecordBase<>), new
Dictionary<string, string>
                                                         {
 
{"connection.driver_class","NHibernate.Driver.SqlClientDriver"},
 
{"dialect", "NHibernate.Dialect.MsSql2000Dialect"},
 
{"connection.provider","NHibernate.Connection.DriverConnectionProvider"},
 
{"connection.connection_string", "Password=XXXX;Persist Security
Info=True;User ID=UserXXXX;Initial Catalog=MyDB;Data
Source=ServerDb1;Min Pool Size=5;Max Pool Size=100;Connect
Timeout=60;"},
 
{"proxyfactory.factory_class",
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle"}
                                                         }); //
Framework (LOG)

            source.Add(typeof(BaseModel<>), new Dictionary<string,
string>
                                                         {
 
{"connection.driver_class","NHibernate.Driver.SqlClientDriver"},
 
{"dialect", "NHibernate.Dialect.MsSql2000Dialect"},
 
{"connection.provider","NHibernate.Connection.DriverConnectionProvider"},
 
{"connection.connection_string", "Password=XXXX;Persist Security
Info=True;User ID=UserXXXX;Initial Catalog=MyDB;Data
Source=ServerDb1;Min Pool Size=5;Max Pool Size=100;Connect
Timeout=60;"},
 
{"proxyfactory.factory_class",
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle"}
                                                         }); // Botao
e Acesso

            source.Add(typeof(ChatBaseModel<,>), new
Dictionary<string, string>
                                                         {
 
{"connection.driver_class","NHibernate.Driver.SqlClientDriver"},
 
{"dialect", "NHibernate.Dialect.MsSql2000Dialect"},
 
{"connection.provider","NHibernate.Connection.DriverConnectionProvider"},
 
{"connection.connection_string", "Password=XXXX;Persist Security
Info=True;User ID=UserXXXX;Initial Catalog=MyDB;Data
Source=ServerDb1;Min Pool Size=5;Max Pool Size=100;Connect
Timeout=60;"},
 
{"proxyfactory.factory_class",
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle"}
                                                         }); // Chat

            source.Add(typeof(ControleAcessoBaseModel<>), new
Dictionary<string, string>
                                                         {
 
{"connection.driver_class","NHibernate.Driver.SqlClientDriver"},
 
{"dialect", "NHibernate.Dialect.MsSql2000Dialect"},
 
{"connection.provider","NHibernate.Connection.DriverConnectionProvider"},
 
{"connection.connection_string", "Password=XXXX;Persist Security
Info=True;User ID=userXXXX;Initial Catalog= PRD_SERVER01;Data Source=
ServerDb1;Min Pool Size=5;Max Pool Size=100;Connect Timeout=60;"},
 
{"proxyfactory.factory_class",
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle"}
                                                         }); // Link
para a tabela de Usuarios

            Assembly[] asms = {
                                  Assembly.Load("Sof.Log"), //
Exceller Log
                                  Assembly.Load
("Exceller.Context"), // Contexto do Exceller
                                  Assembly.Load
("ChatManager.Model"), // Chat
                                  Assembly.Load
("ControleAcesso.Model"), // Controle de Acesso
                              };

            ActiveRecordStarter.Initialize(asms, source);
**********************


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to