Created
August 8, 2010 19:22
-
-
Save boriscallens/514442 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Boris.BeekProject.Model.Beek; | |
using MvcTurbine.ComponentModel; | |
using MvcTurbine.Ninject; | |
using MvcTurbine.Web; | |
using Ninject; | |
namespace Boris.BeekProject.Guis.Shared | |
{ | |
public class MvcApplication : TurbineApplication | |
{ | |
private static readonly IKernel ninjectKernel; | |
private static readonly NinjectServiceLocator provider; | |
static MvcApplication() | |
{ | |
ninjectKernel = MvcTurbineContainerFactory.CreateNinjectKernel(); | |
provider = new NinjectServiceLocator(ninjectKernel); | |
ServiceLocatorManager.SetLocatorProvider(() => provider); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Mvc; | |
namespace Boris.BeekProject.Guis.Shared.Controllers | |
{ | |
public class HomeController : Controller | |
{ | |
public HomeController() {} | |
public ActionResult Index() | |
{ | |
return View(ViewData); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Title="" Language="C#" MasterPageFile="~/views/shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> | |
<asp:Content ContentPlaceHolderID="Main" runat="server"> | |
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p> | |
<ul> | |
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li> | |
<li>Aliquam tincidunt mauris eu risus.</li> | |
<li>Vestibulum auctor dapibus neque.</li> | |
</ul> | |
<h1>HTML Ipsum Presents</h1> | |
</asp:Content> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MvcTurbineContainerFactory | |
{ | |
private static IKernel kernel; | |
public static IKernel CreateNinjectKernel() | |
{ | |
if (kernel != null) | |
{ | |
return kernel; | |
} | |
kernel = new StandardKernel(); | |
kernel.Bind<ILoggingService>() | |
.To<NlogLoggingService>(); | |
kernel.Bind<IBeekRepository>() | |
.To<Db4oBeekRepository>() | |
.InSingletonScope() | |
.WithConstructorArgument("beekServer", Db4oFactory.OpenServer(IOHelper.MakeAbsolute(ConfigurationManager.AppSettings["beekRepository.path.db4o"]), 0)); | |
kernel.Bind<IUserRepository>() | |
.To<UserRepository>() | |
.InSingletonScope(); | |
kernel.Bind<IAccountService>() | |
.To<AccountService>() | |
.InSingletonScope(); | |
kernel.Bind<IUser>() | |
.To<User>(); | |
kernel.Bind<ISearchService>() | |
.To<SearchService>() | |
.InSingletonScope() | |
.Named("db4oSearchService"); | |
kernel.Bind<ISearchService>() | |
.To<IsbnDbSearchService>() | |
.InSingletonScope() | |
.Named("isbnDbSearchService") | |
.WithConstructorArgument("baseRequestUrl", ConfigurationManager.AppSettings["isbnDb.baseRequestString"]); | |
return kernel; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> | |
<html xmlns="http://www.w3.org/1999/xhtml" > | |
<head runat="server"> | |
<title>Beek <asp:ContentPlaceHolder ID="Title" runat="server"/></title> | |
<asp:ContentPlaceHolder ID="Css" runat="server"/> | |
</head> | |
<body> | |
<div id="page"> | |
<div id="content"> | |
<div id="scrollWrapper"> | |
<asp:ContentPlaceHolder ID="Main" runat="server"/> | |
</div> | |
</div> | |
</div> | |
<asp:ContentPlaceHolder ID="Js" runat="server"/> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment