Last active
October 14, 2019 11:42
-
-
Save serkanince/8033b25f720f0f7cc6c91cb41de69fd0 to your computer and use it in GitHub Desktop.
Repository Pattern
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.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
namespace Sample.Repository | |
{ | |
public interface IRepository<T> | |
{ | |
IQueryable getAll(); | |
} | |
} |
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.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Text; | |
namespace Sample.Repository | |
{ | |
public class SehirRepository : IRepository | |
{ | |
AzureDBContext _context; | |
public SehirRepository(AzureDBContext context) | |
{ | |
_context = context; | |
} | |
//Bu metod IRepository sınıfından geliyor. Kalıtım aldığınız tüm modellerde zorunlu olarak eklenmesi gerekecek | |
public IQueryable GetAll() | |
{ | |
return _context.SehirEntity.GetAll(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment