This file contains 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
<#@ template language="C#" HostSpecific="True" inherits="DynamicTransform" #> | |
<#@ Output Extension="cs" #> | |
<#@ import namespace="System.Collections" #> | |
<#@ import namespace="System.Collections.Generic" #> | |
<#@ import namespace="System" #> | |
<#@ import namespace="System.Linq" #> | |
<#@ import namespace="System.Text.RegularExpressions" #> | |
<#@ import namespace="EnvDTE" #> | |
namespace <#= Model.ControllerNamespace #> | |
{ |
This file contains 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
[T4Scaffolding.ControllerScaffolder("Controller with read/write action and views, using EF data access code", Description = "Adds an ASP.NET MVC controller with views and data access code", SupportsModelType = $true, SupportsDataContextType = $true, SupportsViewScaffolder = $true)][CmdletBinding()] | |
param( | |
[parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)][string]$ControllerName, | |
[string]$ModelType, | |
[string]$Project, | |
[string]$CodeLanguage, | |
[string]$DbContextType, | |
[string]$Area, | |
[string]$ViewScaffolder = "View", | |
[alias("MasterPage")][string]$Layout, |
This file contains 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
Could not load type 'System.Func`2' from assembly 'SharpArch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. | |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. | |
Exception Details: System.TypeLoadException: Could not load type 'System.Func`2' from assembly 'SharpArch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. | |
Source Error: | |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
This file contains 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
Could not load type 'System.Func`2' from assembly 'SharpArch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. | |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. | |
Exception Details: System.TypeLoadException: Could not load type 'System.Func`2' from assembly 'SharpArch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. | |
Source Error: | |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
This file contains 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
// #001 Using Query Objects | |
namespace SharpArchCookbook.Web.Mvc.Controllers.Queries.Products | |
{ | |
using Domain; | |
using MvcContrib.Pagination; | |
using NHibernate.Transform; | |
using SharpArch.NHibernate; | |
using ViewModels; |
This file contains 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
private static void AddApplicationServicesTo(IWindsorContainer container) | |
{ | |
container.Register( | |
AllTypes | |
.FromAssemblyNamed("SharpArchCookbook.Tasks") | |
.Pick() | |
.WithService.FirstInterface()); | |
} | |
private static void AddQueriesTo(IWindsorContainer container) |
This file contains 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
// Business object living in the Domain layer | |
public class Project : Entity | |
{ | |
public virtual string Name { get; set; } | |
} | |
// Controller | |
public class HomeController : Controller | |
{ |
This file contains 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 abstract class CreateCommandHandler<TCommand> : CommandHandler<TCommand> where TCommand : ICommand | |
{ | |
public override void Handle(TCommand command) | |
{ | |
var aggregateRoot = CreateAggregateRoot(command); | |
Handle(command, aggregateRoot); | |
var domainRepository = ServiceLocator.Current.Resolve<IDomainRepository>(); | |
This file contains 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 TempDataExtension | |
{ | |
public static void Put(this TempDataDictionary tempData, string key, object value) | |
{ | |
var js = new JavaScriptSerializer(); | |
tempData[key] = js.Serialize(value); | |
} | |
public static T Get<T>(this TempDataDictionary tempData, string key) where T : class | |
{ |
This file contains 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
var car = new Car | |
{ | |
Make = "Toyota", | |
AWD = true | |
}; | |
TempData.Put("Automobile", car); | |
TempData.Get<Motorcycle>("Automobile") |
OlderNewer