Skip to content

Instantly share code, notes, and snippets.

@geoffreysmith
geoffreysmith / gist:5753569
Created June 11, 2013 00:08
sample sitecore lucene index
<configuration xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<databases>
<database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<Engines.HistoryEngine.Storage>
<obj type="Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel">
<param connectionStringName="$(id)" />
<EntryLifeTime>30.00:00:00</EntryLifeTime>
</obj>
</Engines.HistoryEngine.Storage>
public class NavigationItem : SitecoreItem
{
}
[SitecoreType]
public class NavigationFolder : SitecoreItem
{
[SitecoreField("Main Menu")]
public virtual IEnumerable<NavigationItem> MainMenu { get; set; }
}
public static class GlassMapperScCustom
{
public static void CastleConfig(IWindsorContainer container)
{
var config = new Config();
container.Install(new SitecoreInstaller(config));
container.Register(
Component.For<ISitecoreContext>().ImplementedBy<SitecoreContext>().LifestyleTransient(),
@geoffreysmith
geoffreysmith / gist:5544474
Last active December 17, 2015 03:38
Automated Sitecore installation in Dropkick
public class TheDeployment : Deployment<TheDeployment, DeploymentSettings>
{
public TheDeployment()
{
Define(settings => DeploymentStepsFor(SitecoreInstallation, s =>
{
s.UnzipArchive(settings.SitecoreArchivePath).To(settings.SitecoreExtractPath).DeleteDestinationBeforeDeploying();
s.CopyDirectory(settings.SitecoreExtractPath + @"Sitecore 6.6.0 rev. 130404\Website\").To(settings.WebsitePath).ClearDestinationBeforeDeploying();
@geoffreysmith
geoffreysmith / gist:1264524
Created October 5, 2011 14:13
TempDataextensionsUsage
var car = new Car
{
Make = "Toyota",
AWD = true
};
TempData.Put("Automobile", car);
TempData.Get<Motorcycle>("Automobile")
@geoffreysmith
geoffreysmith / gist:1264520
Created October 5, 2011 14:12
TempDataExtensions
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
{
@geoffreysmith
geoffreysmith / gist:1118349
Created August 1, 2011 15:29
simplecqrs createcommand
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>();
@geoffreysmith
geoffreysmith / gist:1006489
Created June 3, 2011 15:08
Simple SharpArch repo demo
// Business object living in the Domain layer
public class Project : Entity
{
public virtual string Name { get; set; }
}
// Controller
public class HomeController : Controller
{
@geoffreysmith
geoffreysmith / gist:972788
Created May 15, 2011 00:57
Query dependency injection
private static void AddApplicationServicesTo(IWindsorContainer container)
{
container.Register(
AllTypes
.FromAssemblyNamed("SharpArchCookbook.Tasks")
.Pick()
.WithService.FirstInterface());
}
private static void AddQueriesTo(IWindsorContainer container)
// #001 Using Query Objects
namespace SharpArchCookbook.Web.Mvc.Controllers.Queries.Products
{
using Domain;
using MvcContrib.Pagination;
using NHibernate.Transform;
using SharpArch.NHibernate;
using ViewModels;