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<T> where T: class | |
| { | |
| void Add( T Entity); | |
| void Delete( T Entity); | |
| void Update ( T Entity); | |
| IQueryable<T> GetAll<T>(); | |
| //some more methods | |
| } | |
| public interface IDatabaseFactory : IDisposable |
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
| using System; | |
| using System.Data.Entity; | |
| namespace EFRepository.Infrastructure | |
| { | |
| /// <summary> | |
| /// Represents an IUnitOfWork for Entity Framework | |
| /// </summary> | |
| public class EFUnitOfWork : IUnitOfWork | |
| { |
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
| using System; | |
| using System.Linq; | |
| namespace EFRepository.Infrastructure | |
| { | |
| /// <summary> | |
| /// Generic interface for the Repository. | |
| /// </summary> | |
| /// <typeparam name="T">EntityType T</typeparam> | |
| public interface IRepository<T> |
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
| using System; | |
| namespace EFRepository.Infrastructure | |
| { | |
| /// <summary> | |
| /// The Interface for implementing a UnitOfWork in the Repository | |
| /// </summary> | |
| public interface IUnitOfWork : IDisposable | |
| { | |
| void Commit(); |
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
| using System; | |
| namespace EFRepository.Infrastructure | |
| { | |
| [Serializable] | |
| public class UnitOfWorkException : Exception | |
| { | |
| public override string Message | |
| { | |
| get |
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
| using System; | |
| using System.Data.Entity; | |
| using System.Linq; | |
| namespace EFRepository.Infrastructure | |
| { | |
| /// <summary> | |
| /// A EFRepository represents the repository for performing operations on the | |
| /// Entity using the EntityFramework. | |
| /// </summary> |
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
| <CodeSnippets | |
| xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
| <CodeSnippet Format="1.0.0"> | |
| <Header> | |
| <Title>NUnitTestSnippet</Title> | |
| <Author>Ashutosh</Author> | |
| <Description>Creates a NUnit Test Snippet</Description> | |
| <Shortcut>nunit</Shortcut> | |
| </Header> | |
| <Snippet> |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <configuration> | |
| <configSections> | |
| <section name="razor" type="Nancy.ViewEngines.Razor.RazorConfigurationSection, Nancy.ViewEngines.Razor" /> | |
| <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> | |
| <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> | |
| <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> |
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 ExpandoObject ToExpando(this object anonymousObject) | |
| { | |
| IDictionary<string, object> anonymousDictionary = new RouteValueDictionary(anonymousObject); | |
| IDictionary<string, object> expando = new ExpandoObject(); | |
| foreach (var item in anonymousDictionary) | |
| expando.Add(item); | |
| return (ExpandoObject) expando; | |
| } |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using Nancy.ModelBinding; | |
| public class DynamicModelBinder : IModelBinder | |
| { | |
| public object Bind(NancyContext context, Type modelType, object instance, BindingConfig configuration, params string[] blackList) | |
| { | |
| var data = |
OlderNewer