Esempio n. 1
0
        public static void Configure()
        {
            ObjectFactory.Configure(c =>
            {
                c.Scan(x =>
                {
                    x.TheCallingAssembly();
                    x.WithDefaultConventions();
                    x.AssemblyContainingType <IFriendsService>(); // Core
                });

                // Configure WebAPI
                c.For <HttpClient>().Singleton().Use(() => ApiConfig.GetClient());

                // Configure Implementations
                //c.For<ISendEmail>().Use<DebugEmailSender>();
                //c.For<IQueryUsersByEmail>().Use<EfQueryUserByEmail>();
                //c.For<IFriendRepository>().Use<EfFriendRepository>();

                // Now we don't need all of the above configure implementations as now we're talking to the api through the below implementations
                // Hence no need to add reference to infrastructure project in this case
                c.For <IUserService>().Use <WebApiUserService>();
                c.For <IFriendsService>().Use <WebApiFriendsService>();
            });
        }
Esempio n. 2
0
        public static Container Configure()
        {
            var container = new Container(c =>
            {
                c.Scan(x =>
                {
                    x.TheCallingAssembly();
                    x.WithDefaultConventions();
                    x.AssemblyContainingType <IFriendService>(); // Core
                });

                // Configure WebAPI
                c.For <WebClient>().Singleton().Use(() => ApiConfig.GetClient());

                // Configure Implementations
                // c.For<ISendEmail>().Use<DebugEmailSender>();
                // c.For<IUserService>().Use<WebApiUserService>();
                c.For <IFriendService>().Use <WebApiFriendsService>();
                c.For <IJsonModelConvertor>().Use <JsonModelConvertor>();
            });

            return(container);
        }