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 class Order | |
{ | |
public Order() | |
{ | |
this.Address = new Address(); | |
} | |
public virtual Address Address { get; set; } | |
} |
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 class MyAppPrimaryKeyConvention : IConfigurationConvention<PropertyInfo, PrimitivePropertyConfiguration> | |
{ | |
public void Apply(PropertyInfo memberInfo, Func<PrimitivePropertyConfiguration> configuration) | |
{ | |
if (memberInfo.Name == "Id") | |
{ | |
// We need to avoid overriding concrete class mapped using TPH. | |
if (memberInfo.ReflectedType.IsSubclassOf(typeof(ProductFeature)) || | |
memberInfo.ReflectedType.IsSubclassOf(typeof(ProductInsert))) | |
{ |
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
DbDatabase.SetInitializer<MyAppContext>(null); |
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 class IdeaMap : ClassMap<Idea> | |
{ | |
public IdeaMap() | |
{ | |
Id(x => x.Id) | |
.Column("ID") | |
.GeneratedBy.Identity(); | |
Map(x => x.Summary).Not.Nullable(); | |
Map(x => x.Description).WithMaxSize().Not.Nullable(); |
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
AutoMapper.Mapper.AssertConfigurationIsValid(); |
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
using System; | |
using System.ServiceModel.Description; | |
using Castle.Core.Logging; | |
/// <summary> | |
/// Being a custom EndpointBehavior added to the WCF services such that each operation outputs | |
/// a debug log message before and after invocation. | |
/// </summary> | |
public class OperationLoggingEndpointBehavior : IEndpointBehavior | |
{ |
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
using System; | |
using System.ServiceModel.Channels; | |
using System.ServiceModel.Description; | |
using System.ServiceModel.Dispatcher; | |
using Castle.Core.Logging; | |
/// <summary> | |
/// Being a custom EndpointBehavior added to the WCF services to provide custom error handling functionality. | |
/// Namely, logging error so it doesn't get ignored. | |
/// </summary> |
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
/// <summary> | |
/// Finds leads in the repository by Customer Name. | |
/// </summary> | |
/// <param name="repo" />Repository of Leads</param> | |
/// <param name="customerName" />Customer name</param> | |
/// <returns>Leads matching the criteria</returns> | |
public static IQueryable<Lead> ByCustomerName(this IQueryable<Lead> repo, string customerName) | |
{ | |
if (customerName.IsNullOrEmpty()) | |
{ |
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
using System; | |
using System.ServiceModel.Description; | |
using System.ServiceModel.Dispatcher; | |
/// <summary> | |
/// Being a custom EndpointBehavior added to the WCF services such that each operation begins a | |
/// new unit of work when invoked, and closes the same unit of work after invocation. | |
/// </summary> | |
/// <remarks> | |
/// In practice, we are using this simply to manage NHibernate sessions - opening a new Session at |
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
using System; | |
namespace MvcGotcha1.Models | |
{ | |
public class FooModel | |
{ | |
public int FooCounter { get; set; } | |
} | |
} |