{"id":97676,"date":"2025-02-16T02:55:36","date_gmt":"2025-02-15T23:25:36","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/repository-pattern-ste-c-me-solid-arkhes-3m17\/"},"modified":"2025-02-16T02:55:36","modified_gmt":"2025-02-15T23:25:36","slug":"repository-pattern-ste-c-me-solid-arkhes-3m17","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/repository-pattern-ste-c-me-solid-arkhes-3m17\/","title":{"rendered":"\u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646 \u062f\u0631 C# \u0628\u0627 \u0627\u0635\u0648\u0644 \u0645\u062d\u06a9\u0645"},"content":{"rendered":"<div data-article-id=\"2281331\" id=\"article-body\">\n<p>\u062f\u0631 <strong>\u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646<\/strong> \u06cc\u06a9\u06cc \u0627\u0632 \u0645\u062d\u0628\u0648\u0628 \u062a\u0631\u06cc\u0646 \u0627\u0633\u062a (<strong>\u0627\u0644\u06af\u0648\u0647\u0627\u06cc \u0637\u0631\u0627\u062d\u06cc<\/strong>) \u0628\u0631\u0627\u06cc \u062c\u062f\u0627 \u06a9\u0631\u062f\u0646 \u0627\u0648 <strong>\u0645\u0646\u0637\u0642\u06cc<\/strong> \u0627\u0632 \u0637\u0631\u0641 <strong>\u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647<\/strong>\u0628\u0634\u0631 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f \u06a9\u062f \u0628\u0627\u0634\u062f <strong>\u062a\u0645\u06cc\u0632 \u060c \u0627\u0646\u0639\u0637\u0627\u0641 \u067e\u0630\u06cc\u0631 \u0648 \u0642\u0627\u0628\u0644 \u0627\u0631\u062a\u0642\u0627.<\/strong><\/p>\n<p><strong>&#8211; \u0686\u0631\u0627 \u0627\u0632 \u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645\u061f<\/strong><\/p>\n<p><strong>\u0645\u0632\u0627\u06cc\u0627<\/strong><\/p>\n<p>\u2714 <strong>\u062a\u0641\u06a9\u06cc\u06a9<\/strong> &#8211; \u0645\u062e\u0632\u0646 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0631\u0627 \u0627\u0632 \u0645\u0646\u0637\u0642 \u062a\u062c\u0627\u0631\u062a \u062c\u062f\u0627 \u0645\u06cc \u06a9\u0646\u062f.<br \/>\u2714 <strong>\u062c\u0627\u06cc\u06af\u0632\u06cc\u0646\u06cc \u0622\u0633\u0627\u0646<\/strong> &#8211; \u0627\u06af\u0631 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u0627\u0632 \u0686\u0627\u0631\u0686\u0648\u0628 \u0645\u0648\u062c\u0648\u062f\u06cc\u062a \u0628\u0647 Dapper \u06cc\u0627 ORM \u062f\u06cc\u06af\u0631 \u062a\u063a\u06cc\u06cc\u0631 \u06a9\u0646\u06cc\u0645 \u060c \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u062f\u0648\u0646 \u062a\u063a\u06cc\u06cc\u0631 \u06a9\u0644 \u0628\u0631\u0646\u0627\u0645\u0647 \u060c \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u062f\u0647\u06cc\u0645.<br \/>\u2714 <strong>\u062a\u0633\u062a \u0647\u0627\u06cc \u0648\u0627\u062d\u062f \u03b3\u03b9\u03b1 \u0631\u0627 \u0645\u0633\u062e\u0631\u0647 \u0645\u06cc \u06a9\u0646\u062f<\/strong> &#8211; \u0645\u0627 \u0628\u0647 \u0631\u0627\u062d\u062a\u06cc \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u0627 \u0628\u0647\u0628\u0648\u062f \u0622\u0632\u0645\u0627\u06cc\u0634 \u060c \u0645\u062e\u0627\u0632\u0646 \u0631\u0627 \u062a\u0647\u06cc\u0647 \u06a9\u0646\u06cc\u0645.<br \/>\u2714 <strong>\u0645\u062f\u06cc\u0631\u06cc\u062a \u062f\u0627\u062f\u0647 \u0628\u0647\u062a\u0631<\/strong> &#8211; \u06cc\u06a9 \u0631\u0648\u06cc\u06a9\u0631\u062f \u0627\u0635\u0644\u06cc \u0628\u0631\u0627\u06cc \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u062f\u0627\u062f\u0647 \u0647\u0627 \u0641\u0631\u0627\u0647\u0645 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<p><strong>&#8211; \u0627\u0635\u0648\u0644 \u062c\u0627\u0645\u062f \u0648 \u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646<\/strong><\/p>\n<p>\u0647\u0646\u06af\u0627\u0645 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646 \u060c \u067e\u06cc\u0631\u0648\u06cc \u0627\u0632 \u0627\u0635\u0648\u0644 \u062c\u0627\u0645\u062f \u0628\u0631\u0627\u06cc \u062a\u0645\u06cc\u0632 \u0646\u06af\u0647 \u062f\u0627\u0634\u062a\u0646 \u06a9\u062f \u0648 \u0642\u0627\u0628\u0644 \u0627\u0631\u062a\u0642\u0627\u0621 \u0645\u0647\u0645 \u0627\u0633\u062a.<\/p>\n<p>1\u20e3 <strong>\u0627\u0635\u0644 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u0648\u0627\u062d\u062f (SRP)<\/strong> &#8211; \u0647\u0631 \u0645\u062e\u0632\u0646 \u0628\u0627\u06cc\u062f \u06cc\u06a9 \u0645\u0633\u0626\u0648\u0644\u06cc\u062a \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u062f: \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u06cc\u06a9 \u0646\u0647\u0627\u062f \u062e\u0627\u0635.<br \/>2 <strong>\u0627\u0635\u0644 \u0628\u0633\u062a\u0647 (OCP)<\/strong> &#8211; \u0645\u0627 \u0628\u0627\u06cc\u062f \u0628\u062f\u0648\u0646 \u062a\u063a\u06cc\u06cc\u0631 \u06a9\u062f \u0645\u0648\u062c\u0648\u062f \u0628\u062a\u0648\u0627\u0646\u06cc\u0645 \u0645\u062e\u0627\u0632\u0646 \u06cc\u0627 \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0647\u0627\u06cc \u062c\u062f\u06cc\u062f \u0631\u0627 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0646\u06cc\u0645.<br \/>3\u20e3 <strong>\u0627\u0635\u0644 \u062a\u0639\u0648\u06cc\u0636 \u0644\u06cc\u0633\u06a9\u0648\u0641 (LSP)<\/strong> &#8211; \u0647\u0631 \u0645\u062e\u0632\u0646 \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0628\u0627 \u062f\u06cc\u06af\u0631\u06cc \u062c\u0627\u06cc\u06af\u0632\u06cc\u0646 \u06a9\u0631\u062f \u0628\u062f\u0648\u0646 \u0627\u06cc\u0646\u06a9\u0647 \u0645\u0634\u06a9\u0644\u06cc \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u062f.<br \/>4\u20e3 <strong>\u0627\u0635\u0644 \u062a\u0641\u06a9\u06cc\u06a9 \u0631\u0627\u0628\u0637 (ISP)<\/strong> &#8211; \u0628\u0647 \u062c\u0627\u06cc \u0645\u062e\u0632\u0646 \u0628\u0627 \u0631\u0648\u0634 \u0647\u0627\u06cc \u0645\u062e\u062a\u0644\u0641 \u060c \u0628\u0647\u062a\u0631 \u0627\u0633\u062a \u0631\u0627\u0628\u0637 \u0647\u0627\u06cc \u062a\u062e\u0635\u0635\u06cc \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f.<br \/>5\u20e3 <strong>\u0627\u0635\u0644 \u0648\u0627\u0631\u0648\u0646\u06af\u06cc \u0648\u0627\u0628\u0633\u062a\u06af\u06cc (DIP)<\/strong> &#8211; \u0645\u062e\u0632\u0646 \u0646\u0628\u0627\u06cc\u062f \u0645\u0633\u062a\u0642\u06cc\u0645\u0627\u064b \u0628\u0647 ORM (\u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0645\u062b\u0627\u0644 \u0686\u0627\u0631\u0686\u0648\u0628 \u0645\u0648\u062c\u0648\u062f\u06cc\u062a) \u0628\u0633\u062a\u06af\u06cc \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u062f \u060c \u0628\u0644\u06a9\u0647 \u0628\u0647 \u0627\u0646\u062a\u0632\u0627\u0639 \u0627\u0633\u062a.<\/p>\n<p><strong>\u0645\u062e\u0632\u0646 \u0645\u062b\u0627\u0644 \u062f\u0631 C# \u0628\u0627 \u0627\u0635\u0648\u0644 \u0645\u062d\u06a9\u0645<\/strong><\/p>\n<p>1\u20e3 <strong>\u0646\u0647\u0627\u062f (\u0646\u0647\u0627\u062f)<\/strong><\/p>\n<p>\u0641\u0631\u0636 \u06a9\u0646\u06cc\u062f \u0645\u0627 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627 \u0622\u0646 \u062f\u0627\u0631\u06cc\u0645 <strong>\u0645\u0634\u062a\u0631\u06cc\u0627\u0646<\/strong><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>public class Customer\n{\n    public int Id { get; set; }\n    public string Name { get; set; }\n    public string Email { get; set; }\n}\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>2 <strong>\u0627\u06cc\u062c\u0627\u062f \u0645\u062e\u0632\u0646 \u0639\u0645\u0648\u0645\u06cc (\u0645\u062e\u0632\u0646 \u0639\u0645\u0648\u0645\u06cc)<\/strong><\/p>\n<p>\u0628\u0648\u0647\u0627 <strong>\u0645\u062e\u0632\u0646 \u0639\u0645\u0648\u0645\u06cc (\u0645\u062e\u0632\u0646 \u0639\u0645\u0648\u0645\u06cc)<\/strong> \u0628\u0647 \u0645\u0627 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f \u062a\u0627 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u0645 <strong>\u06a9\u062f \u0642\u0627\u0628\u0644 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u062c\u062f\u062f<\/strong><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>public interface IRepository<t> where T : class\n{\n    Task<t> GetByIdAsync(int id);\n    Task<ienumerable>&gt; GetAllAsync();\n    Task AddAsync(T entity);\n    Task UpdateAsync(T entity);\n    Task DeleteAsync(int id);\n}\n<\/ienumerable><\/t><\/t><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>3\u20e3 <strong>\u0627\u062c\u0631\u0627\u06cc \u0645\u062e\u0632\u0646 \u0639\u0645\u0648\u0645\u06cc \u0628\u0627 \u0686\u0627\u0631\u0686\u0648\u0628 \u0645\u0648\u062c\u0648\u062f\u06cc\u062a<\/strong><\/p>\n<p>\u062f\u0631 <strong>\u0647\u0633\u062a\u0647 EF<\/strong> \u0628\u0631\u0627\u06cc \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>public class Repository<t> : IRepository<t> where T : class\n{\n    protected readonly AppDbContext _context;\n    protected readonly DbSet<t> _dbSet;\n\n    public Repository(AppDbContext context)\n    {\n        _context = context;\n        _dbSet = context.Set<t>();\n    }\n\n    public async Task<t> GetByIdAsync(int id) =&gt; await _dbSet.FindAsync(id);\n\n    public async Task<ienumerable>&gt; GetAllAsync() =&gt; await _dbSet.ToListAsync();\n\n    public async Task AddAsync(T entity)\n    {\n        await _dbSet.AddAsync(entity);\n        await _context.SaveChangesAsync();\n    }\n\n    public async Task UpdateAsync(T entity)\n    {\n        _dbSet.Update(entity);\n        await _context.SaveChangesAsync();\n    }\n\n    public async Task DeleteAsync(int id)\n    {\n        var entity = await _dbSet.FindAsync(id);\n        if (entity != null)\n        {\n            _dbSet.Remove(entity);\n            await _context.SaveChangesAsync();\n        }\n    }\n}\n<\/ienumerable><\/t><\/t><\/t><\/t><\/t><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>4\u20e3 <strong>\u0627\u06cc\u062c\u0627\u062f \u0645\u062e\u0632\u0646 \u062a\u062e\u0635\u0635\u06cc \u0628\u0631\u0627\u06cc \u0645\u0634\u062a\u0631\u06cc\u0627\u0646 (\u0645\u062e\u0632\u0646 \u0645\u0634\u062a\u0631\u06cc)<\/strong><\/p>\n<p>\u0628\u0647 \u062c\u0627\u06cc \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u0646 <strong>\u062a\u0645\u0627\u0645 \u0631\u0648\u0634\u0647\u0627\u06cc \u0645\u0648\u062c\u0648\u062f \u062f\u0631 \u06cc\u06a9 \u0645\u062e\u0632\u0646<\/strong>\u060c \u0645\u0627 \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc \u06a9\u0646\u06cc\u0645 <strong>\u0645\u062e\u0627\u0632\u0646 \u062a\u062e\u0635\u0635\u06cc.<\/strong><\/p>\n<p><strong>4.1 \u0645\u0627 \u06cc\u06a9 \u0631\u0627\u0628\u0637 \u062a\u062e\u0635\u0635\u06cc \u0631\u0627 \u062a\u0639\u0631\u06cc\u0641 \u0645\u06cc \u06a9\u0646\u06cc\u0645<\/strong><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>public interface ICustomerRepository : IRepository<customer>\n{\n    Task<customer> GetByEmailAsync(string email);\n}\n<\/customer><\/customer><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>4.2 \u0627\u062c\u0631\u0627\u06cc \u0645\u062e\u0632\u0646 \u0645\u0634\u062a\u0631\u06cc<\/strong><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>public class CustomerRepository : Repository<customer>, ICustomerRepository\n{\n    public CustomerRepository(AppDbContext context) : base(context) { }\n\n    public async Task<customer> GetByEmailAsync(string email)\n    {\n        return await _context.Customers.FirstOrDefaultAsync(c =&gt; c.Email == email);\n    }\n}\n<\/customer><\/customer><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0622\u06cc\u0627 \u062e\u0648\u0628 \u0627\u0633\u062a \u06a9\u0647 \u0645\u062e\u0627\u0632\u0646 \u0632\u06cc\u0627\u062f\u06cc \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06cc\u0627 \u06cc\u06a9 \u0631\u0648\u0634 \u0628\u0632\u0631\u06af \u0628\u0627 \u0631\u0648\u0634 \u0647\u0627\u06cc \u0632\u06cc\u0627\u062f\u06cc\u061f<\/strong><\/p>\n<p>\ud83d\udc49 <strong>\u0628\u0647\u062a\u0631\u06cc\u0646 \u0631\u0648\u0634 \u062f\u0627\u0634\u062a\u0646 \u0645\u062e\u0627\u0632\u0646 \u06a9\u0648\u0686\u06a9 \u0648 \u062a\u062e\u0635\u0635\u06cc \u0627\u0633\u062a.<\/strong><\/p>\n<p>\ud83d\udd39 <strong>\u0645\u0634\u06a9\u0644 \u0628\u0627 \u06cc\u06a9 \u0645\u062e\u0632\u0646 \u0639\u0638\u06cc\u0645:<\/strong><\/p>\n<ul>\n<li>\u062d\u0641\u0638 \u0622\u0646 \u062f\u0634\u0648\u0627\u0631 \u0645\u06cc \u0634\u0648\u062f.<\/li>\n<li>\u0627\u06cc\u0646 \u0627\u0635\u0644 \u062a\u0641\u06a9\u06cc\u06a9 \u0631\u0627\u0628\u0637 (ISP) \u0631\u0627 \u0646\u0642\u0636 \u0645\u06cc \u06a9\u0646\u062f.<\/li>\n<li>\u0627\u06af\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0631\u0634\u062f \u06a9\u0646\u062f \u060c \u0645\u062e\u0632\u0646 \u0686\u0646\u062f \u0628\u0631\u0627\u0628\u0631 \u0645\u06cc \u0634\u0648\u062f.<\/li>\n<\/ul>\n<p>\ud83d\udd39 <strong>\u0631\u0627\u0647 \u062d\u0644:<\/strong><\/p>\n<ul>\n<li>\u0628\u0648\u0647\u0627 <strong>\u0645\u062e\u0632\u0646 \u0639\u0645\u0648\u0645\u06cc<\/strong> \u0628\u0631\u0627\u06cc \u062a\u0648\u0627\u0628\u0639 \u0627\u0633\u0627\u0633\u06cc (CRUD).<\/li>\n<li>\n<strong>\u0645\u062e\u0627\u0632\u0646 \u062a\u062e\u0635\u0635\u06cc<\/strong> \u0628\u0631\u0627\u06cc \u067e\u0631\u0633 \u0648 \u062c\u0648\u0647\u0627\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647 \u06cc\u0627 \u0645\u0646\u0637\u0642 \u06a9\u0633\u0628 \u0648 \u06a9\u0627\u0631 (\u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0645\u062b\u0627\u0644 icustomerrepository).<\/li>\n<\/ul>\n<p><strong>\ud83d\udd39 \u0686\u06af\u0648\u0646\u0647 \u0645\u06cc \u062a\u0648\u0627\u0646\u06cc\u0645 \u0628\u062f\u0648\u0646 \u0646\u06cc\u0627\u0632 \u0628\u0647 \u0627\u062c\u0631\u0627\u06cc \u0622\u0646 \u060c \u06cc\u06a9 \u0631\u0627\u0628\u0637 \u0631\u0627 \u0628\u0647 \u0627\u0631\u062b \u0628\u0628\u0631\u06cc\u0645\u061f<\/strong><\/p>\n<p>\u0627\u06af\u0631 \u06cc\u06a9 \u06a9\u0644\u0627\u0633 \u0628\u0627\u0634\u062f <strong>\u06cc\u06a9 \u0631\u0627\u0628\u0637 \u0631\u0627 \u0628\u0647 \u0627\u0631\u062b \u0645\u06cc \u0628\u0631\u062f<\/strong>\u060c \u0628\u0627\u06cc\u062f \u062a\u0645\u0627\u0645 \u0631\u0648\u0634 \u0647\u0627\u06cc \u0627\u0648 \u0631\u0627 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06a9\u0646\u062f. <strong>\u0627\u0645\u0627 \u0631\u0627\u0647\u06cc \u0628\u0631\u0627\u06cc \u062c\u0644\u0648\u06af\u06cc\u0631\u06cc \u0627\u0632 \u0627\u062c\u0631\u0627\u06cc \u0627\u062c\u0628\u0627\u0631\u06cc \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f!<\/strong><\/p>\n<p>\ud83d\udc49 <strong>\u0631\u0627\u0647 \u062d\u0644:<\/strong> \u0645\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645 <strong>\u06cc\u06a9 \u06a9\u0644\u0627\u0633 \u0645\u062a\u0648\u0633\u0637<\/strong> (\u06a9\u0644\u0627\u0633 \u0627\u0646\u062a\u0632\u0627\u0639\u06cc \u03ae \u06a9\u0644\u0627\u0633 \u067e\u0627\u06cc\u0647).<\/p>\n<p><strong>\u0646\u0645\u0648\u0646\u0647<\/strong><\/p>\n<p>\u0641\u0631\u0636 \u06a9\u0646\u06cc\u062f \u0645\u0627 \u06cc\u06a9 ICUSTOMERREPORITORE \u0631\u0627\u0628\u0637 \u062f\u0627\u0631\u06cc\u0645 \u0648 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u06cc\u06a9 \u067e\u0627\u06cc\u0647 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u0645 \u06a9\u0647 \u0646\u06cc\u0627\u0632\u06cc \u0628\u0647 \u0627\u062c\u0631\u0627\u06cc \u0647\u0645\u0647 \u0631\u0648\u0634 \u0647\u0627 \u0646\u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u062f.<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>public abstract class BaseRepository<t> : IRepository<t> where T : class\n{\n    public virtual Task<t> GetByIdAsync(int id) =&gt; throw new NotImplementedException();\n    public virtual Task<ienumerable>&gt; GetAllAsync() =&gt; throw new NotImplementedException();\n    public virtual Task AddAsync(T entity) =&gt; throw new NotImplementedException();\n    public virtual Task UpdateAsync(T entity) =&gt; throw new NotImplementedException();\n    public virtual Task DeleteAsync(int id) =&gt; throw new NotImplementedException();\n}\n<\/ienumerable><\/t><\/t><\/t><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u27a1 <strong>\u0627\u06a9\u0646\u0648\u0646 \u060c \u0647\u0631 \u0627\u0631\u062b \u0645\u062e\u0632\u0646<\/strong> \u03c4\u03bf \u067e\u0627\u06cc\u0647 \u06af\u0630\u0627\u0631\u06cc*<em>\u060c \u0627\u06af\u0631 \u0628\u0647 \u0622\u0646\u0647\u0627 \u0627\u062d\u062a\u06cc\u0627\u062c \u0646\u062f\u0627\u0631\u06cc\u062f \u060c \u0644\u0627\u0632\u0645 \u0646\u06cc\u0633\u062a \u062a\u0645\u0627\u0645 \u0631\u0648\u0634\u0647\u0627\u06cc CRUD \u0631\u0627 \u067e\u06cc\u0627\u062f\u0647 \u0633\u0627\u0632\u06cc \u06a9\u0646\u0645!<\/em>*<\/p>\n<p>\ud83d\udccc <strong>\u067e\u0627\u06cc\u0627\u0646<\/strong><br \/>\u2714 \u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646 <strong>\u0633\u0627\u062e\u062a\u0627\u0631 \u06a9\u062f \u0631\u0627 \u0628\u0647\u0628\u0648\u062f \u0645\u06cc \u0628\u062e\u0634\u062f.<\/strong><br \/>\u2714 \u062a\u0631\u062c\u06cc\u062d \u062f\u0627\u062f\u0647 \u0645\u06cc \u0634\u0648\u062f <strong>\u0645\u062e\u0627\u0632\u0646 \u062a\u062e\u0635\u0635\u06cc<\/strong> \u0628\u0647 \u062c\u0627\u06cc \u06cc\u06a9 \u0639\u0638\u06cc\u0645<br \/>\u2714 \u0627\u06af\u0631 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u0628\u062f\u0648\u0646 \u0627\u062c\u0631\u0627\u06cc \u06cc\u06a9 \u0631\u0627\u0628\u0637 \u0628\u0647 \u0627\u0631\u062b \u0628\u0628\u0631\u06cc\u0645 \u060c \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645 <strong>\u06a9\u0644\u0627\u0633\u0647\u0627\u06cc \u0627\u0646\u062a\u0632\u0627\u0639\u06cc.<\/strong><\/p>\n<p><strong>\u0647\u0645\u0686\u0646\u06cc\u0646 \u0628\u0628\u06cc\u0646\u06cc\u062f:<\/strong> \u062f\u0633\u062a\u0647 \u0628\u0646\u062f\u06cc \u0639\u0645\u0644\u06a9\u0631\u062f\u0647\u0627\u06cc \u0628\u0627\u062f\u0648\u0627\u0645 \u0648 \u0632\u0645\u0627\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0622\u0646\u0647\u0627<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u062f\u0631 \u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646 \u06cc\u06a9\u06cc \u0627\u0632 \u0645\u062d\u0628\u0648\u0628 \u062a\u0631\u06cc\u0646 \u0627\u0633\u062a (\u0627\u0644\u06af\u0648\u0647\u0627\u06cc \u0637\u0631\u0627\u062d\u06cc) \u0628\u0631\u0627\u06cc \u062c\u062f\u0627 \u06a9\u0631\u062f\u0646 \u0627\u0648 \u0645\u0646\u0637\u0642\u06cc \u0627\u0632 \u0637\u0631\u0641 \u062f\u0633\u062a\u0631\u0633\u06cc \u0628\u0647 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647\u0628\u0634\u0631 \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f \u06a9\u062f \u0628\u0627\u0634\u062f \u062a\u0645\u06cc\u0632 \u060c \u0627\u0646\u0639\u0637\u0627\u0641 \u067e\u0630\u06cc\u0631 \u0648 \u0642\u0627\u0628\u0644 \u0627\u0631\u062a\u0642\u0627. &#8211; \u0686\u0631\u0627 \u0627\u0632 \u0627\u0644\u06af\u0648\u06cc \u0645\u062e\u0632\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u06cc\u0645\u061f \u0645\u0632\u0627\u06cc\u0627 \u2714 \u062a\u0641\u06a9\u06cc\u06a9 &#8211; \u0645\u062e\u0632\u0646 \u067e\u0627\u06cc\u06af\u0627\u0647 \u062f\u0627\u062f\u0647 \u0631\u0627 \u0627\u0632 \u0645\u0646\u0637\u0642 \u062a\u062c\u0627\u0631\u062a \u062c\u062f\u0627 \u0645\u06cc \u06a9\u0646\u062f.\u2714 &hellip;<\/p>\n","protected":false},"author":2,"featured_media":97677,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-97676","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/97676","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=97676"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/97676\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/97677"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=97676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=97676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=97676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}