Initialization

using Microsoft.Practices.Unity;
using Fuse8.DomainFramework.Common.Locator;
using Fuse8.DomainFramework.UnityLocator;

public class MvcApplication : HttpApplication
{
    protected void Application_Start()
    {
        IUnityContainer container = new UnityContainer();
        var locator = new UnityServiceLocatorWithLazy(container);
        DependencyServiceLocator.SetLocatorProvider(() => locator);

        container.RegisterInstance<IConnectionStringFactory>(new ConnectionStringFactory());

        // register domain entities stored in MS SQL database
        container.RegisterSimpleSql<Development>();
            
        ...
    }
}

Connection String Factory

using Fuse8.DomainFramework.Practices.Domain.Interfaces;

public class ConnectionStringFactory : IConnectionStringFactory
{
    public string GetConnectionString<T>()
    {
        return "Data Source=...";
    } 
}

Create entities

public class Development : Int32EntityObject
{
    ...
}

Last edited Apr 1, 2013 at 9:09 AM by olgabutova, version 1

Comments

No comments yet.