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
# adapted from http://notes.jimlindley.com/2008/3/25/git-svn-that-works-for-me | |
# initial setup | |
git svn clone <svn_repo> | |
# begin the workflow | |
git svn fetch -r HEAD --ignore-paths="Package.zip" # aliased to 'git up', my Package.zip is very large. | |
git svn rebase -l # we just updated, no need to go back to the svn repo | |
# 99% of daily workflow |
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
private void MapAllPersistentObjects() | |
{ | |
var openType = typeof(IdToEntityConverter<>); | |
var guidType = typeof(Guid); | |
var allPersistentObjects = | |
from t in typeof(Customer).Assembly.GetTypes() | |
where typeof(Entity).IsAssignableFrom(t) | |
let converterType = openType.MakeGenericType(t) | |
select new {EntityType = t, ConverterType = converterType}; |
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 class AutoMapperConfiguration | |
{ | |
public static void Configure() | |
{ | |
Mapper.Initialize(x => x.AddProfile<ViewModelProfile>()); | |
} | |
} | |
public class ViewModelProfile : Profile | |
{ |
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 bool IsSubclassOfOpenGeneric(this Type type, Type generic) | |
{ | |
while (type != typeof(object)) | |
{ | |
var current = type.IsGenericType ? type.GetGenericTypeDefinition() : type; | |
if (generic == current) | |
{ | |
return true; | |
} | |
type = type.BaseType; |
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 bool IsSubclassOfOpenGeneric(this Type type, Type generic) | |
{ | |
// fine! | |
return type != typeof(object) && | |
(generic == (type.IsGenericType ? type.GetGenericTypeDefinition() : type) || | |
type.BaseType.IsSubclassOfOpenGeneric(generic)); | |
} |
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 interface IRepository | |
{ | |
void Save<ENTITY>(ENTITY entity) | |
where ENTITY : DomainEntity; | |
ENTITY Load<ENTITY>(Guid id) | |
where ENTITY : DomainEntity; | |
IQueryable<ENTITY> Query<ENTITY>() | |
where ENTITY : DomainEntity; |
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 interface IOrderRepository : IRepository<Order> | |
{ | |
Order[] GetAllOrderForCustomer(Customer customer); | |
int GetCountOfOrdersForCustomer(Customer customer); | |
bool HasOpenOrders(Customer customer); | |
Order[] GetAllOpenOrders(Customer customer); | |
Order[] GetOrdersHavingRefunds(Customer customer); | |
Order[] GetOrdersWithFundsAvailableForRefund(Customer customer); | |
Order[] GetAllSignificantOrderForCustomer(Customer customer); | |
Order[] GetBySearchCriteria(IOrderCriteria criteria); |
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 interface IOrderRepository : IRepository<Order> | |
{ | |
Order[] GetAllOrderForCustomer(Customer customer); | |
int GetCountOfOrdersForCustomer(Customer customer); | |
bool HasOpenOrders(Customer customer); | |
Order[] GetAllOpenOrders(Customer customer); | |
Order[] GetOrdersHavingRefunds(Customer customer); | |
Order[] GetOrdersWithFundsAvailableForRefund(Customer customer); | |
Order[] GetAllSignificantOrderForCustomer(Customer customer); | |
Order[] GetBySearchCriteria(IOrderCriteria criteria); |
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 class BaseReportPage<TModel> : BaseViewPage<TModel>, IViewBase where TModel : class | |
{ | |
// ... | |
protected override void OnPreInit(EventArgs e) | |
{ | |
if (ShowAsPdf) | |
{ | |
string path = _configuration.GetPrincePath(); | |
var prince = new Prince(path); |
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 DomainEvents | |
{ | |
public static IContainer Container { get; set; } | |
public static IDomainEvent LastRaised { get; private set; } | |
public static void Raise<T>(T args) where T : IDomainEvent | |
{ | |
if (Container != null) | |
foreach (var handler in Container.GetAllInstances<IHandler<T>>()) | |
handler.Handle(args); |
OlderNewer