﻿
{"id":12812,"date":"2019-12-16T22:09:30","date_gmt":"2019-12-16T22:09:30","guid":{"rendered":"https:\/\/www.gencayyildiz.com\/blog\/?p=12812"},"modified":"2019-12-16T22:09:30","modified_gmt":"2019-12-16T22:09:30","slug":"asp-net-core-cok-katmanli-mimaride-istenilen-katmanda-dependency-injection-kullanimi","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/asp-net-core-cok-katmanli-mimaride-istenilen-katmanda-dependency-injection-kullanimi\/","title":{"rendered":"Asp.NET Core  &#8211; \u00c7ok Katmanl\u0131 Mimaride \u0130stenilen Katmanda Dependency Injection Kullan\u0131m\u0131"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>\u00d6nceki i\u00e7eriklerimizden <a href=\"https:\/\/www.gencayyildiz.com\/blog\/asp-net-core-3-0-cok-katmanli-mimaride-migration-islemleri\/\" rel=\"noopener noreferrer\" target=\"_blank\">Asp.NET Core 3.0 \u2013 \u00c7ok Katmanl\u0131 Mimaride Migration \u0130\u015flemleri<\/a> ba\u015fl\u0131kl\u0131 makalemizde \u00e7ok katmanl\u0131 mimari yap\u0131lanmas\u0131n\u0131n migration i\u015flemleriyle birlikte yap\u0131sal inceliklerini ele alm\u0131\u015ft\u0131k. \u0130lgili makaleye g\u00f6z atarsan\u0131z e\u011fer, katmanlar aras\u0131nda <code>DAL -> BL -> PL<\/code> olmas\u0131 gereken ili\u015fkiyi <code>DAL -> PL && (BL -> PL)<\/code> \u015feklinde kurdu\u011fumuzu g\u00f6receksiniz.  Bunun nedeni DAL katman\u0131 arac\u0131l\u0131\u011f\u0131yla veritaban\u0131ndan gelen verileri BL katman\u0131nda i\u015fleyebilmek i\u00e7in BL katman\u0131nda DAL katman\u0131ndaki repository, context vs. nesnelerinin dependency injection ile talep edilebiliyor olmas\u0131 gerekmektedir. Bunun i\u00e7inde PL katman\u0131nda talep edilen bu nesneler BL&#8217;ye g\u00f6nderilmekte ve dolay\u0131s\u0131yla PL&#8217;de DAL katman\u0131n\u0131 referans g\u00f6stermek mecburiyetinde kal\u0131nmaktad\u0131r. Bu mecburiyet esas\u0131nda \u00e7ok katmanl\u0131 mimari dedi\u011fimiz stratejik yakla\u015f\u0131m\u0131 zedelemekte ve stratejide taktiksel hataya sebebiyet vermektedir. \u0130\u015fte bizler bu makalemizde BL katman\u0131nda PL&#8217;ye gereksinim duymaks\u0131z\u0131n dependency injection stratejisinin nas\u0131l uygulamas\u0131 gerekti\u011fini ele alacak ve ortaya mimarisel a\u00e7\u0131dan ideal yakla\u015f\u0131m\u0131n nas\u0131l olmas\u0131 gerekti\u011fini irdeleyerek, do\u011fru yap\u0131lanman\u0131n somut \u00f6rne\u011fini geli\u015ftirece\u011fiz.<\/p>\n<p>Yani uzun laf\u0131n k\u0131sas\u0131; PL katman\u0131nda DAL katman\u0131n\u0131 referans etmeksizin(<span style=\"font-size:11px;\">mesela &#8220;Startup.cs&#8221; dosyas\u0131na context nesnesini AddDbContext ile eklemeksizin<\/span>) t\u00fcm veritaban\u0131 i\u015flemlerini BL katman\u0131nda ihtiyaca d\u00f6n\u00fck nas\u0131l yap\u0131land\u0131r\u0131laca\u011f\u0131n\u0131 inceleyece\u011fiz.<\/p>\n<p>\u015eimdi ad\u0131m ad\u0131m \u00e7ok katmanl\u0131 mimari yakla\u015f\u0131m\u0131n\u0131 benimsedi\u011fimiz bir proje geli\u015ftirelim. Her\u015feyden \u00f6nce en temel katman\u0131m\u0131z olan DAL katman\u0131n\u0131 ele alarak i\u015fe ba\u015flayal\u0131m.<\/p>\n<ul>\n<li>\n<strong>DAL<\/strong><br \/>\nVeritaban\u0131(context) nesnesi ve migration vs. gibi yap\u0131lanmalar\u0131n bulundu\u011fu katmand\u0131r.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/Asp.NET-Core-\u00c7ok-Katmanl\u0131-Mimaride-\u0130stenilen-Katmanda-Dependency-Injection-Kullan\u0131m\u0131.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/Asp.NET-Core-\u00c7ok-Katmanl\u0131-Mimaride-\u0130stenilen-Katmanda-Dependency-Injection-Kullan\u0131m\u0131.png\" alt=\"Asp.NET Core - \u00c7ok Katmanl\u0131 Mimaride \u0130stenilen Katmanda Dependency Injection Kullan\u0131m\u0131\" width=\"299\" height=\"226\" class=\"aligncenter size-full wp-image-12818\" \/><\/a><br \/>\nKaynak kodlar olduk\u00e7a standart yap\u0131da oldu\u011fu i\u00e7in ekstradan g\u00f6stermeye l\u00fczum g\u00f6rmemekteyim.\n<\/li>\n<li>\n<strong>Entities<\/strong><br \/>\nDAL katman\u0131yla y\u00fcksek oranda ili\u015fkisel nesneleri bar\u0131nd\u0131racak olan Entities katman\u0131 i\u00e7erisinde uygulamada kullan\u0131lacak t\u00fcm entity yap\u0131lanlar\u0131n\u0131 bar\u0131nd\u0131rmaktad\u0131r. Entityler; DAL&#8217;\u0131n d\u0131\u015f\u0131nda BL, PL ve hatta \u00e7o\u011fu custom katmanda ihtiyaca d\u00f6n\u00fck kullan\u0131ld\u0131\u011f\u0131ndan dolay\u0131 g\u00f6n\u00fcl rahatl\u0131\u011f\u0131yla istenilen katman taraf\u0131ndan referans edilebilmesi ve \u00e7ok katmanl\u0131 mimari yap\u0131lanmas\u0131n\u0131 zedelememek i\u00e7in DAL&#8217;dan ayr\u0131lm\u0131\u015ft\u0131r.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/Asp.NET-Core-\u00c7ok-Katmanl\u0131-Mimaride-\u0130stenilen-Katmanda-Dependency-Injection-Kullan\u0131m\u0131-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/Asp.NET-Core-\u00c7ok-Katmanl\u0131-Mimaride-\u0130stenilen-Katmanda-Dependency-Injection-Kullan\u0131m\u0131-1.png\" alt=\"Asp.NET Core - \u00c7ok Katmanl\u0131 Mimaride \u0130stenilen Katmanda Dependency Injection Kullan\u0131m\u0131\" width=\"208\" height=\"127\" class=\"aligncenter size-full wp-image-12819\" \/><\/a>\n<\/li>\n<li>\n<strong>BL<\/strong><br \/>\nBilindi\u011fi gibi her t\u00fcrl\u00fc i\u015f, eylem, fiiliyat, algoritma, istatistik vs. yani operasyonel t\u00fcm i\u015flevleri kapsayan katmand\u0131r. Bizler \u00f6rne\u011fimizde Repository yap\u0131lanmas\u0131n\u0131 kullanaca\u011f\u0131m\u0131zdan dolay\u0131 BL katman\u0131m\u0131zda ilgili yap\u0131lanmaya dair \u00e7al\u0131\u015fmalar bulunmaktad\u0131r.<br \/>\n<a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/Asp.NET-Core-\u00c7ok-Katmanl\u0131-Mimaride-\u0130stenilen-Katmanda-Dependency-Injection-Kullan\u0131m\u0131-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/Asp.NET-Core-\u00c7ok-Katmanl\u0131-Mimaride-\u0130stenilen-Katmanda-Dependency-Injection-Kullan\u0131m\u0131-2.png\" alt=\"Asp.NET Core - \u00c7ok Katmanl\u0131 Mimaride \u0130stenilen Katmanda Dependency Injection Kullan\u0131m\u0131\" width=\"282\" height=\"254\" class=\"aligncenter size-full wp-image-12827\" \/><\/a><\/p>\n<p>BL katman\u0131ndaki bu \u00e7al\u0131\u015fmalar dependency injection gerektirdi\u011finde PL \u00fczerinden beslenmeyece\u011finden dolay\u0131 buradaki dependency injection provider\u0131na ilgili nesneleri atabilmeli ve yeri geldi\u011finde kullanabilmeliyiz. Bu nokta kritik \u00f6nem arz etmekte oldu\u011fundan dolay\u0131 odaklanmam\u0131z gereken merkezlerden birisidir.<\/p>\n<p>\u015eimdi gelin BL katman\u0131ndaki t\u00fcm in\u015fa s\u00fcrecini tek tek ele al\u0131p, bu i\u015flemin nas\u0131l ger\u00e7ekle\u015ftirildi\u011fini konu\u015fal\u0131m.<\/p>\n<ul>\n<li><strong style=\"color:green;\">IRepository Interface&#8217;i<\/strong><br \/>\nRepository imzas\u0131n\u0131 sunan aray\u00fczd\u00fcr.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public interface IRepository&lt;T&gt; where T : class\r\n    {\r\n        List&lt;T&gt; Get();\r\n        List&lt;A&gt; Get&lt;A&gt;() where A : class;\r\n        List&lt;T&gt; GetWhere(Expression&lt;Func&lt;T, bool&gt;&gt; metot);\r\n        List&lt;A&gt; GetWhere&lt;A&gt;(Expression&lt;Func&lt;A, bool&gt;&gt; metot) where A : class;\r\n        T GetSingle(Func&lt;T, bool&gt; metot);\r\n        A GetSingle&lt;A&gt;(Func&lt;A, bool&gt; metot) where A : class;\r\n        T GetById(int id);\r\n        A GetById&lt;A&gt;(int id) where A : class;\r\n        bool Add(T model);\r\n        bool Add&lt;A&gt;(A model) where A : class;\r\n        bool Remove(T model);\r\n        bool Remove&lt;A&gt;(A model) where A : class;\r\n        bool Remove(int id);\r\n        bool Remove&lt;A&gt;(int id) where A : class;\r\n        bool Update(T model, int id);\r\n        bool Update&lt;A&gt;(A model, int id) where A : class;\r\n        int Save();\r\n    }\r\n<\/pre>\n<\/li>\n<li id=\"rsinif\"><strong style=\"color:green;\">Repository S\u0131n\u0131f\u0131<\/strong><br \/>\nRepository yap\u0131lanmas\u0131nda base class olarak kullanaca\u011f\u0131m\u0131z s\u0131n\u0131ft\u0131r.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public class Repository&lt;Type&gt; : IRepository&lt;Type&gt; where Type : class\r\n    {\r\n        protected SirketContext _sirketContext;\r\n        public Repository()\r\n        {\r\n            IServiceCollection services = new ServiceCollection();\r\n            services.AddDbContextService();\r\n            ServiceProvider provider = services.BuildServiceProvider();\r\n\r\n            _sirketContext = provider.GetService&lt;SirketContext&gt;();\r\n        }\r\n        &#x5B;NonAction]\r\n        public DbSet&lt;Type&gt; Table()\r\n        {\r\n            return Table&lt;Type&gt;();\r\n        }\r\n        &#x5B;NonAction]\r\n        public DbSet&lt;A&gt; Table&lt;A&gt;() where A : class\r\n        {\r\n            return _sirketContext.Set&lt;A&gt;();\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Add(Type model)\r\n        {\r\n            return Add&lt;Type&gt;(model);\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Add&lt;A&gt;(A model) where A : class\r\n        {\r\n            Table&lt;A&gt;().Add(model);\r\n            Save();\r\n            return true;\r\n        }\r\n        &#x5B;NonAction]\r\n        public List&lt;Type&gt; Get()\r\n        {\r\n            return Get&lt;Type&gt;();\r\n        }\r\n        &#x5B;NonAction]\r\n        public List&lt;A&gt; Get&lt;A&gt;() where A : class\r\n        {\r\n            return Table&lt;A&gt;().ToList();\r\n        }\r\n        &#x5B;NonAction]\r\n        public Type GetById(int id)\r\n        {\r\n            return GetById&lt;Type&gt;(id);\r\n        }\r\n        &#x5B;NonAction]\r\n        public A GetById&lt;A&gt;(int id) where A : class\r\n        {\r\n            return GetSingle&lt;A&gt;(t =&gt; typeof(A).GetProperty(&quot;Id&quot;).GetValue(t).ToString() == id.ToString());\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Remove(Type model)\r\n        {\r\n            return Remove&lt;Type&gt;(model);\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Remove&lt;A&gt;(A model) where A : class\r\n        {\r\n            Table&lt;A&gt;().Remove(model);\r\n            return true;\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Remove(int id)\r\n        {\r\n            return Remove&lt;Type&gt;(id);\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Remove&lt;A&gt;(int id) where A : class\r\n        {\r\n            A silinecekData = GetSingle&lt;A&gt;(x =&gt; (int)typeof(A).GetProperty(&quot;Id&quot;).GetValue(x) == id);\r\n            Remove&lt;A&gt;(silinecekData);\r\n            Save();\r\n            return true;\r\n        }\r\n        &#x5B;NonAction]\r\n        public int Save()\r\n        {\r\n            return _sirketContext.SaveChanges();\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Update(Type model, int id)\r\n        {\r\n            return Update&lt;Type&gt;(model, id);\r\n        }\r\n        &#x5B;NonAction]\r\n        public bool Update&lt;A&gt;(A model, int id) where A : class\r\n        {\r\n            A guncellenecekNesne = GetById&lt;A&gt;(id);\r\n            var tumPropertyler = typeof(A).GetProperties();\r\n            foreach (var property in tumPropertyler)\r\n                if (property.Name != &quot;Id&quot;)\r\n                    property.SetValue(guncellenecekNesne, property.GetValue(model));\r\n            Save();\r\n            return true;\r\n        }\r\n        &#x5B;NonAction]\r\n        public List&lt;Type&gt; GetWhere(Expression&lt;Func&lt;Type, bool&gt;&gt; metot)\r\n        {\r\n            return GetWhere&lt;Type&gt;(metot);\r\n        }\r\n        &#x5B;NonAction]\r\n        public List&lt;A&gt; GetWhere&lt;A&gt;(Expression&lt;Func&lt;A, bool&gt;&gt; metot) where A : class\r\n        {\r\n            return Table&lt;A&gt;().Where(metot).ToList();\r\n        }\r\n        &#x5B;NonAction]\r\n        public Type GetSingle(Func&lt;Type, bool&gt; metot)\r\n        {\r\n            return GetSingle&lt;Type&gt;(metot);\r\n        }\r\n        &#x5B;NonAction]\r\n        public A GetSingle&lt;A&gt;(Func&lt;A, bool&gt; metot) where A : class\r\n        {\r\n            return Table&lt;A&gt;().FirstOrDefault(metot);\r\n        }\r\n    }\r\n<\/pre>\n<\/li>\n<li><strong style=\"color:green;\">Concreate Repository S\u0131n\u0131flar\u0131<\/strong><br \/>\nEntity bazl\u0131 somut repository s\u0131n\u0131flar\u0131m\u0131zd\u0131r.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public class PersonelRepository : Repository&lt;Personel&gt;\r\n    {\r\n    }\r\n<\/pre>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public class SatisRepository : Repository&lt;Satis&gt;\r\n    {\r\n    }\r\n<\/pre>\n<\/li>\n<li><strong style=\"color:green;\">DbContextService.cs Dosyas\u0131<\/strong><br \/>\nDAL katman\u0131ndaki context nesnesini dependency injectiondan talep edilebilir hale getirmek i\u00e7in ilgili nesneyi providera eklememiz gerekmektedir. Bunun i\u00e7in class librariy&#8217;de dependency injection&#8217;\u0131n nas\u0131l yap\u0131ld\u0131\u011f\u0131n\u0131 ele almam\u0131z gerekmektedir. Esas\u0131nda evvelinde bu konuya dair <a href=\"https:\/\/www.gencayyildiz.com\/blog\/net-core-console-applicationda-dependency-injection-kullanimi\/\" rel=\"noopener noreferrer\" target=\"_blank\">\u015furadaki<\/a> makaleyi kaleme alm\u0131\u015f bulunmaktay\u0131m. Burada biraz soluklan\u0131p ilgili makaleye g\u00f6z atabilirsiniz. K\u0131saca \u00f6zetlemek gerekirse bu i\u015flem i\u00e7in IServiceCollection aray\u00fcz\u00fc kullan\u0131lmaktad\u0131r. <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    static class DbContextService\r\n    {\r\n        public static IServiceCollection AddDbContextService(this IServiceCollection services)\r\n        {\r\n            ServiceProvider provider = services.BuildServiceProvider();\r\n\r\n            services.AddDbContext&lt;SirketContext&gt;(x =&gt; x.UseSqlServer(&quot;Server=.;Database=SirketDB;Trusted_Connection=True;&quot;));\r\n            return services;\r\n        }\r\n    }\r\n<\/pre>\n<p>Yukar\u0131daki kod blo\u011funu incelerseniz e\u011fer IServiceCollection aray\u00fcz\u00fcne \u00f6zel bir extension metot geli\u015ftirilmi\u015ftir. \u0130lgili metot, services parametresi \u00fczerinden provider in\u015fa etmekte ve \u00fcretilen bu providera &#8220;AddDbContext&#8221; metodu ile DAL katman\u0131ndaki context nesnemizi gerekli konfig\u00fcrasyonlar\u0131yla birlikte eklemektedir.<\/p>\n<p>Ve yukar\u0131da inceledi\u011fimiz repository s\u0131n\u0131f\u0131na<a href=\"#rsinif\" style=\"font-size:8px;\">sat\u0131ra gitmek i\u00e7in t\u0131klay\u0131n\u0131z<\/a> g\u00f6z atarsan\u0131z e\u011fer ilgili s\u0131n\u0131f\u0131n 4 ile 11. sat\u0131r aral\u0131\u011f\u0131nda tan\u0131mlanm\u0131\u015f olan constructer metodu i\u00e7erisinde \u00fcretilen ServiceCollection nesnesi \u00fczerinden bu olu\u015fturdu\u011fumuz &#8220;AddDbContextService&#8221; isimli metot \u00e7a\u011fr\u0131lmakta ve olu\u015fturulan provider \u00fczerinden de context nesnemiz talep edilmektedir. B\u00f6ylece uygulama, PL katman\u0131nda DAL referans\u0131na ihtiya\u00e7 duymaks\u0131z\u0131n direkt olarak BL katman\u0131nda veritaban\u0131 yetene\u011fini kazanmaktad\u0131r.\n<\/li>\n<li><strong style=\"color:green;\">RepositoryService.cs Dosyas\u0131<\/strong><br \/>\nYukar\u0131da olu\u015fturulan repository iskeletinide benzer mant\u0131kla dependency injection provider\u0131na ekleyebilme sorumlulu\u011funu \u00fcstlenmesi i\u00e7in olu\u015fturdu\u011fumuz dosyad\u0131r.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public static class RepositoryService\r\n    {\r\n        public static IServiceCollection AddRepositoryService(this IServiceCollection services)\r\n        {\r\n            services.AddTransient&lt;IRepository&lt;Personel&gt;&gt;(x =&gt; new PersonelRepository());\r\n            services.AddTransient&lt;IRepository&lt;Satis&gt;&gt;(x =&gt; new SatisRepository());\r\n            return services;\r\n        }\r\n    }\r\n<\/pre>\n<p>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere generic parametresine g\u00f6re repository nesneleri \u00fcretilmekte ve Transient ile dependency injection provider\u0131na eklenmektedir.\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u00dcretilen Servislerin Enjekte Edilmesi<\/h3>\n<p>Bu i\u015flem i\u00e7in yap\u0131lmas\u0131 gereken tek \u015fey PL katman\u0131nda Startup.cs dosyas\u0131n\u0131n &#8220;ConfigureServices&#8221; metodunda &#8220;AddRepositoryService&#8221; isimli metodu \u00e7a\u011f\u0131rmakt\u0131r. B\u00f6ylece t\u00fcm repository nesnelerimiz uygulamaya inject edilmi\u015f olacakt\u0131r. <em><strong>Peki hoca, context nesnesini nas\u0131l inject edece\u011fiz?<\/strong><\/em> sorunuzu duyar gibiyim&#8230; Hat\u0131rlarsan\u0131z e\u011fer onu zaten BL katman\u0131ndaki olu\u015fturdu\u011fumuz Repository s\u0131n\u0131f\u0131nda inject edip kullanm\u0131\u015ft\u0131k. O y\u00fczden PL&#8217;de context nesnesine dair inject i\u015flemine gerek yoktur.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public class Startup\r\n    {\r\n        public void ConfigureServices(IServiceCollection services)\r\n        {\r\n            .\r\n            .\r\n            services.AddRepositoryService();\r\n            .\r\n            .\r\n        }\r\n    }\r\n<\/pre>\n<p>Bu i\u015flemin ard\u0131ndan art\u0131k controller s\u0131n\u0131flar\u0131n\u0131z\u0131, context nesnelerini inject etmeye ihtiya\u00e7 duymaks\u0131z\u0131n olu\u015fturabilir ve endpointler yahut actionlar\u0131n\u0131z\u0131 repository ile g\u00f6n\u00fcl rahatl\u0131\u011f\u0131yla kullanabilirsiniz.<\/p>\n<p>\u00d6rnek bir controller;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n    public class PersonelController : Controller\r\n    {\r\n        readonly PersonelRepository _personelRepository;\r\n        public PersonelController(IRepository&lt;Personel&gt; personelRepository)\r\n        {\r\n            _personelRepository = (PersonelRepository)personelRepository;\r\n        }\r\n        public IActionResult Index()\r\n        {\r\n            return View(_personelRepository.Get());\r\n        }\r\n\r\n        public IActionResult Create()\r\n        {\r\n            return View();\r\n        }\r\n\r\n        &#x5B;HttpPost]\r\n        public IActionResult Create(Personel model)\r\n        {\r\n            _personelRepository.Add(model);\r\n            _personelRepository.Save();\r\n            return RedirectToAction(&quot;Index&quot;);\r\n        }\r\n    }\r\n<\/pre>\n<p>Nihai olarak;<br \/>\nGenellikle DAL katman\u0131nda olu\u015fturulan context s\u0131n\u0131f\u0131n\u0131n PL&#8217;de kullan\u0131larak i\u015flevsel olarak problem yaratmayan ama \u00e7ok katmanl\u0131 mimari stratejisinin eti\u011fine ayk\u0131r\u0131 olan bu davran\u0131\u015f\u0131 irdeledi\u011fimiz y\u00f6ntemde oldu\u011fu gibi ortadan kald\u0131rm\u0131\u015f ve stratejiyi olmas\u0131 gereken en do\u011fru y\u00f6ntemlerle, prensibe uygun bir \u015fekle getirip oturtturmu\u015f bulunmaktay\u0131z.<\/p>\n<p>\u0130lgilenenlerin faydalanmas\u0131 dile\u011fiyle&#8230;<br \/>\nSonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<p>Not : \u00d6rnek projeyi indirebilmek i\u00e7in <a href=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2019\/12\/NTierDependencyInjection.zip\">buraya<\/a> t\u0131klay\u0131n\u0131z.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, \u00d6nceki i\u00e7eriklerimizden Asp.NET Core 3.0 \u2013 \u00c7ok Katmanl\u0131 Mimaride Migration \u0130\u015flemleri ba\u015fl\u0131kl\u0131 makalemizde \u00e7ok katmanl\u0131 mimari yap\u0131lanmas\u0131n\u0131n migration i\u015flemleriyle birlikte yap\u0131sal inceliklerini ele alm\u0131\u015ft\u0131k. \u0130lgili makaleye g\u00f6z atarsan\u0131z e\u011fer, katmanlar aras\u0131nda DAL ->&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":12839,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2739,3033,2668,2656,2811,2832,2898],"tags":[3038,2662,3039,148,3097,946,3096],"class_list":["post-12812","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net-core","category-net-core-3-0","category-asp-net-core-2","category-asp-net-core-2-mvc","category-asp-net-core-2-1","category-asp-net-core-2-2","category-asp-net-core-3-0","tag-asp-net-core-cok-katmanli-mimari","tag-asp-net-core-dependency-injection","tag-asp-net-core-n-tier-architecture","tag-cok-katmanli-mimari","tag-cok-katmanli-mimari-dependency-injection","tag-dependency-injection","tag-iservicecollection"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/12812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=12812"}],"version-history":[{"count":38,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/12812\/revisions"}],"predecessor-version":[{"id":12857,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/12812\/revisions\/12857"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/12839"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=12812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=12812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=12812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}