/// <summary>
/// Load your modules or register your
services here
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<string>()
.ToMethod(f =>
#pragma warning disable 0618 //disable obsolete warning as this is the ONLY place this method should be used in the application
ProjectDb.Adapter.EfExtensions.CreateConnectionString(
#pragma warning restore 0618
"data source=databaseSource;initial
catalog=YourDbName;integrated
security=True;multipleactiveresultsets=True;App=EntityFramework"))
.Named("efString");
kernel.Bind(typeof(Project.Shared.Behaviors.IRepository<>))
.To<ProjectDb.Adapter.DEVEntities>()
.InThreadScope()
.WithConstructorArgument("connectionString",kernel.Get<string>("efString"));
}
I’m writing another book!
1 week ago