Skip to content

Instantly share code, notes, and snippets.

@serkanince
Last active October 14, 2019 11:42
Show Gist options
  • Save serkanince/8033b25f720f0f7cc6c91cb41de69fd0 to your computer and use it in GitHub Desktop.
Save serkanince/8033b25f720f0f7cc6c91cb41de69fd0 to your computer and use it in GitHub Desktop.
Repository Pattern
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();
}
}
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