Skip to content

Instantly share code, notes, and snippets.

Marcin Malinowski MaLiN2223

  • Copenhagen
View GitHub Profile
View DbSetInitializer.cs
public static class DbSetInitializer
{
public static void InitDb<T>(IQueryable<T> set, IQueryable<T> data) where T : class
{
set.Provider.Returns(data.Provider);
set.Expression.Returns(data.Expression);
set.ElementType.Returns(data.ElementType);
set.GetEnumerator().Returns(data.GetEnumerator());
set.AsNoTracking().Returns(data);
}
@MaLiN2223
MaLiN2223 / AutomapperExtensions.cs
Last active Dec 29, 2017
Extensions for automapper
View AutomapperExtensions.cs
public static class AutomapperExtensions
{
public static IMappingExpression<TSource, TDestination> Ignore<TSource, TDestination>(
this IMappingExpression<TSource, TDestination> map,
Expression<Func<TDestination, object>> selector)
{
map.ForMember(selector, options => options.Ignore());
return map;
}
public static IMappingExpression<TSource, TDestination> Define<TSource, TDestination>(
You can’t perform that action at this time.