<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yasin Gündoğdu on Medium]]></title>
        <description><![CDATA[Stories by Yasin Gündoğdu on Medium]]></description>
        <link>https://medium.com/@yasingundogdu93?source=rss-c2354e1a76f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*e96ZgoFLQGL2ZbOry_c9kw.jpeg</url>
            <title>Stories by Yasin Gündoğdu on Medium</title>
            <link>https://medium.com/@yasingundogdu93?source=rss-c2354e1a76f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 02:47:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yasingundogdu93/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Rule Engine Pattern Ne İşe Yarar? Nasıl Uygulanır?]]></title>
            <link>https://medium.com/defactoteknoloji/rule-engine-pattern-ne-i%CC%87%C5%9Fe-yarar-nas%C4%B1l-uygulan%C4%B1r-7f37742bd83?source=rss-c2354e1a76f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f37742bd83</guid>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[rule-engine]]></category>
            <category><![CDATA[refactoring]]></category>
            <dc:creator><![CDATA[Yasin Gündoğdu]]></dc:creator>
            <pubDate>Mon, 28 Feb 2022 17:32:53 GMT</pubDate>
            <atom:updated>2024-02-26T12:22:18.901Z</atom:updated>
            <content:encoded><![CDATA[<p>Rule Engine Pattern, SOLID prensiplerini daha iyi uygulamamıza olanak sağlayan bir patterndir.</p><p>Bir çok business rules’a sahip projelerimizde if/else bloklarından sıyrılarak daha düzenli kod yazabilir ve işlerin karmaşıklığını daha basit hale getirebiliriz.</p><p>Bunun yanı sıra yeni kural setleri tanımlanacağı zaman yeni bir if bloğu tanımlayarak kodun karmaşıklığını arttırmak yerine sadece yeni bir class tanımlayarak daha okunaklı, sade, geliştirilebilir ve esnek bir yapı kurmuş oluyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*54pXV1P4o04HGRN15Hb9Ig.jpeg" /></figure><p>Rule Engine iki bileşene sahiptir.</p><ol><li>Rule Engine - Kuralların ne sırada işletileceğini belirler.</li><li>Business Rules - Conditionları tanımlar.</li></ol><p><strong>Nasıl Uygulanır?</strong></p><p>Öncelikle <strong>IValidateRule </strong>interfaceini oluşturuyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l_FkaWUO5so1M3--WoCHvA.png" /></figure><p>Alınacak aksiyonlar ve hangi şartlarda çalışacağını belirlememiz için bu şekilde <strong>interface</strong>imizi oluşturmuş olduk.</p><p>Daha sonrasında <strong>RuleEngine class</strong>ımızı oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WqpXlP3RZ5V4CrXQNoIj2A.png" /></figure><p>Burada kurallarımızı nasıl işleteceğimizi belirlemiş olduk.</p><p>Daha sonra RuleEngine’e parametre geçeceğimiz <strong>RuleEngineService </strong>katmanımızı oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*91WcaqUYYNq2bHIZ5MhdCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xfreDC_iz-TdYTbRAVx2jg.png" /></figure><p>Sıra geldi artık kurallarımızı oluşturmaya. Ben burada yaptığım örnekte 2 adet kuralı ele alacağım. Bir iş yerinde çalışanların 18 yaşından büyük olması ve çalışanlar arasında erkek çalışan varsa askerlik hizmetini yapmış olması.</p><p>İlk kuralımız <strong>AgeLimitRule</strong>’u oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DujGHXEn_-DLIY-7_zMjMQ.png" /></figure><p>Bu kuralın her halükarda işletilmesini istediğim için ShouldRun kısmını direkt <strong>true</strong> olarak ayarladım.</p><p>İkinci kuralımız <strong>MilitaryRule</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7u8sWbWvrAa6siyIqAMBag.png" /></figure><p>Burada çalışanlar arasında erkek çalışan varsa bu kuralın devreye girmesini istediğim için ShouldRun kısmını özelleştirdim.</p><p>Kullanmak isteğimiz Businessta aşağıdaki gibi tanımlamamız yeterli olacaktır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1bH5thzMeUN9jISWpcgNw.png" /></figure><p>Rule Engine Pattern’i uygulamak işte bu kadar basit. Umarım siz de birçok kontrolden geçmesi için yazılmış olan if bloklarından bu şekilde kurtulursunuz.</p><p>Kodları github’a yükledim ve zamanla orayı da geliştirmeye devam edeceğim.</p><p><strong>Referans</strong>: <a href="https://blog.devgenius.io/open-closed-principle-and-rule-engine-design-pattern-904c784501e5">https://blog.devgenius.io/open-closed-principle-and-rule-engine-design-pattern-904c784501e5</a></p><p><strong>Github</strong>:<a href="https://github.com/yasingundogdu/RuleEngineExample/tree/master/RuleEngineExample">https://github.com/yasingundogdu/RuleEngineExample/tree/master/RuleEngineExample</a></p><p><strong>Teşekkür:</strong> Bu yazının oluşmasında katkıları olan iş arkadaşlarım <strong>Kübra Surat</strong> ve <strong>Umut Yılmaz</strong>’a katkılarından dolayı teşekkür ederim.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f37742bd83" width="1" height="1" alt=""><hr><p><a href="https://medium.com/defactoteknoloji/rule-engine-pattern-ne-i%CC%87%C5%9Fe-yarar-nas%C4%B1l-uygulan%C4%B1r-7f37742bd83">Rule Engine Pattern Ne İşe Yarar? Nasıl Uygulanır?</a> was originally published in <a href="https://medium.com/defactoteknoloji">DeFacto Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ASP.NET Core Response Cache Nedir? Neden, Ne Zaman ve Nasıl Kullanılır?]]></title>
            <link>https://medium.com/defactoteknoloji/asp-net-core-response-cache-nedir-neden-ne-zaman-ve-nas%C4%B1l-kullan%C4%B1l%C4%B1r-9001628d978b?source=rss-c2354e1a76f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9001628d978b</guid>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[cache-response]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Yasin Gündoğdu]]></dc:creator>
            <pubDate>Tue, 11 May 2021 03:44:58 GMT</pubDate>
            <atom:updated>2024-02-26T12:22:08.644Z</atom:updated>
            <content:encoded><![CDATA[<p>Merhabalar,</p><p>Bu yazımda sizlere <strong>ASP.NET Core</strong>’da kolaylıkla implement edebileceğimiz <strong>Response Cache</strong> özelliğinden bahsedeceğim.</p><p>Gelişmiş ve büyük sistemlerde <strong>response </strong>sürelerinin performansı elzemdir. Bugünkü ele aldığımız konu da tam olarak bu.</p><p><strong>Response Cache Nedir?</strong></p><p><strong>Response Cache, </strong>HTTP <strong>response</strong>larının cache ile ilgili bilgilerini <strong>headers</strong>’a ekler. <strong>Headers</strong>, <strong>client </strong>ve <strong>proxy</strong> tarafında response’un nasıl <strong>cache</strong>leneceğini belirtir. Böylelikle sunucuya gelen isteklerin sayısını azaltarak performans sağlamış olur.</p><p><strong>Response Cache Neden ve Ne Zaman Kullanılır?</strong></p><p><strong>Response Cache </strong>kullanmaktaki amaç, <strong>client</strong> tarafından gelen <strong>request</strong>lere hızlı <strong>response </strong>dönmekle beraber sunucu tarafına da daha az <strong>request </strong>gelmesini sağlayarak sunucuyu gereksiz yere yormaktan kaçınmaktır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GnXQPf4Q2e0vdUvHMBdxlg.png" /></figure><p>Tabi her <strong>request</strong> için böyle cache üzerinden response dönmek elbette mantıklı değil. Bu özelliği kullanırken göz önünde bulundurmamız gereken durum<strong> response</strong>un değişim sıklığı. Eğer <strong>response</strong>un uzun süre boyunca aynı cevabı vereceğini biliyorsak <strong>Response Cache </strong>kullanmak mantıklı olur.</p><p>Bunu bir örnek üzerinden açıklayacak olursam, mutlaka okunması gereken 4 kitap tavsiyesi veren bir liste olsun. Bu liste benim için uzunca bir süre değişmeyeceği için bunu <strong>Response Cache</strong> ile <strong>cache</strong>ledikten sonra tekrar tekrar sunucuya request gelmesini önleyebilirim.</p><p>Verdiğim örnek üzerinden nasıl kullanacağımıza bakalım.</p><p><strong>Response Cache Nasıl Kullanılır?</strong></p><p>İlk olarak <strong>Startup.cs</strong> dosyasındaki <strong>ConfigureServices </strong>metoduna aşağıdaki kodu ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o3vJKMOw8xRUaHYHI5hbkQ.png" /></figure><p>Burada <strong>Response Cache</strong>’i servislere eklerken belli ayarlarını da yapabiliyoruz.</p><p><strong>MaximumBodySize:</strong> Dönen responseların maksimum boyutunu ayarlıyoruz.</p><p><strong>SizeLimit: Response Cache</strong>’in tutulacağı maksimum boyutu ayarlıyoruz.</p><p><strong>UseCaseSensitivePaths: </strong>Response <strong>cache</strong>lenirken büyük/küçük harfe duyarlı <strong>path</strong> ile tutulacağını ayarlıyoruz.</p><p>Daha sonra <strong>Startup.cs </strong>dosyasındaki<strong> Configure </strong>metoduna aşağıdaki kodu ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_DwtgpxL-Rts6WFhfG5UA.png" /></figure><p>Artık <strong>Response Cache</strong>’i kullanmaya hazırız ama öncelikle bize 4 kitap ve yazar bilgisi dönen <strong>FakeServices</strong>’i yazalım.</p><p>Bunun için önce <strong>Startup.cs</strong> dosyasında <strong>ConfigureServices</strong> metoduna <strong>Singleton</strong> olarak aşağıdaki gibi ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Nl5gj9rXUFpH-xdC7CUiQ.png" /></figure><p><strong>FakeServices</strong>’i de bu şekilde oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3jD6sP6dqphyfivVT_N1w.png" /></figure><p>Geriye <strong>Response Cache</strong>’i controller tarafında kullanmak kaldı.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEN0YTswUECXgW37Ut2I8w.png" /></figure><p>Yukarıdaki gibi <strong>Response Cache</strong>’i kullanabiliriz. Burada set ettiğimiz bazı özelliklerin ne işe yaradığına kısaca değinecek olursak;</p><p><strong>Duration: Response</strong>’un saniye cinsinden ne kadar süre cacheleneceğini belirler.</p><p><strong>Location:</strong> <strong>Response</strong>’un nerede cacheleneceğini belirler. Ben yukarıda<strong> Any</strong> olarak ayarladım. hem<strong> client </strong>tarafında hem <strong>proxy</strong> tarafında cachelenmesi için.</p><p>Sıra geldi test etme aşamasına. İlk defa sayfaya <strong>request</strong> yaptığımız zaman debug’da fonksiyonumuza girdiğini göreceğiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*Hn72bSR-ikoqyF5Yo7rGug.png" /></figure><p>Network üzerinden <strong>Headers </strong>bilgilerini inceleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Xy-vEM8Nhe-NUKn445lXSw.png" /></figure><p>Burada her şeyin olması gerektiği gibi olduğunu görüyoruz. Daha sonraki isteklerde ise <strong>response</strong> bize <strong>cache</strong>den geleceği için aşağıdaki gibi bir ifade görmemiz gerekiyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ibDfUB8uIRu82r4t9577GQ.png" /></figure><p>Artık kitap önerilerinin olduğu sayfamıza<strong> request</strong> geldiğinde <strong>response</strong> bilgisi <strong>cache</strong> üzerinden gelecek. Böylelikle hem <strong>response</strong> süremiz kısalmış oldu hem de sunucuya binecek ekstra yükü azaltmış olduk.</p><p><strong>Response Cache</strong>’in ne işe yaradığına, neden ve ne durumlarda kullanmamız gerektiğine değinmiş olduk.</p><p><strong>Github Linki:</strong> <a href="https://github.com/yasingundogdu/ResponseCacheExamples">https://github.com/yasingundogdu/ResponseCacheExamples</a></p><p><strong>Kaynaklar:</strong> <a href="https://jakeydocs.readthedocs.io/en/latest/performance/caching/response.html#:~:text=Response%20caching%20refers%20to%20specifying,requests%20(if%20at%20all).">https://jakeydocs.readthedocs.io/en/latest/performance/caching/response.html#:~:text=Response%20caching%20refers%20to%20specifying,requests%20(if%20at%20all).</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9001628d978b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/defactoteknoloji/asp-net-core-response-cache-nedir-neden-ne-zaman-ve-nas%C4%B1l-kullan%C4%B1l%C4%B1r-9001628d978b">ASP.NET Core Response Cache Nedir? Neden, Ne Zaman ve Nasıl Kullanılır?</a> was originally published in <a href="https://medium.com/defactoteknoloji">DeFacto Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ASP.NET CORE Middleware Nedir? Nasıl Kullanılır?]]></title>
            <link>https://medium.com/defactoteknoloji/asp-net-core-middleware-nedir-nas%C4%B1l-kullan%C4%B1l%C4%B1r-bb349a457670?source=rss-c2354e1a76f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb349a457670</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[middleware]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Yasin Gündoğdu]]></dc:creator>
            <pubDate>Fri, 07 May 2021 07:32:59 GMT</pubDate>
            <atom:updated>2024-02-26T12:21:56.883Z</atom:updated>
            <content:encoded><![CDATA[<p>Merhabalar,</p><p>ASP.NET Core’da Middleware yapısını ele alarak basit bir senaryo üzerinden nedir ve nasıl yazılır anlatmaya çalışacağım.</p><p><strong>Middleware Nedir?</strong></p><p><strong>Middleware</strong> dediğimiz kavram, <strong>HTTP Pipeline</strong>ının yapı taşıdır ve requestleri handle etmek için geliştirdiğimiz bir ara katmandır. Bu ara katman sayesinde gelen isteklere karşı sistemin vereceği tepkileri özelleştirmemizi sağlar.</p><p>Gelen isteği ilk <strong>Middleware</strong> karşılar. Daha sonra gelen isteği handle ettikten sonra belirli işlemleri yaparak bir sonraki ara katmana iletir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*tKw-LL6xjuM9rkeVOxT3vA.png" /></figure><p><strong>Nasıl Kullanılır?</strong></p><p>Benim burada ele alacağım senaryoda API tarafıyla haberleşmek için gerekli olan <strong>Token</strong>ı alıp <strong>Session</strong>da saklayan ve eğer expire süresi dolmuşsa request esnasında bu Tokenı yenileyen bir <strong>Token Refresher Middleware</strong>i yazmak olacak.</p><p>İlk olarak aşağıdaki gibi <strong>TokenRefresherMiddleware</strong> adında bir Middleware oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omeQrriHeGnnPHQPncV60g.png" /></figure><p>Şimdi de <strong>Startup.cs</strong> dosyasının içindeki <strong>Configure</strong> metodunun içine görseldeki satırı ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28zgaOrw0HLyn5VtjyMKcQ.png" /></figure><p>Artık Middleware <strong>Pipeline</strong>a dahil oldu ve kullanmaya hazırız.</p><p>Senaryomuza göre bir servisten bana authentication için bir Token bilgisi gelmesi lazım. Bunun için fake servis hazırlayalım. Sizin senaryonuzda gerçek bir API isteği de yapabilirsiniz. ben basitçe anlatmak adına işi uzatmayacağım.</p><p>Öncelikle <strong>IFakeApiServices</strong> adında bir interface oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AxYXoZdG1Bhd3Bz4tgbSBA.png" /></figure><p>Daha sonra <strong>FakeApiServices</strong> adındaki classımızı yazıp interfacei implement edelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYAEskEm8jbnweUvaEe82Q.png" /></figure><p>Artık istekte bulunacağımız zaman bize Token bilgisi dönecek bir servisimiz var. Sıra geldi bu Token bilgisini Sessiona yazacak ve lazım olduğunda çağıracak <strong>Manager</strong>ı yazmaya.</p><p><strong>ITokenManager</strong> adındaki interfaceimizi yazalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*-5kQ2_qnQFKi4N-Vir0DUw.png" /></figure><p>get ve set metodlarını belirledikten sonra <strong>TokenManager</strong> classımızı da şu şekilde oluşturalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5dGuxIycIBR3fOsmvFJPg.png" /></figure><p>Yukarıda <strong>HttpContext</strong>e erişebilmek için <strong>IHttpContextAccessor</strong> interfaceini <strong>Dependency Injection</strong>dan yararlanarak kullandık. Bu Injection işlemini gerçekleştirebilmek için <strong>Startup.cs </strong>dosyasındaki <strong>ConfigureServices</strong> metodunun içine aşağıdaki satırı ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FMrktZDn-aA1kzO4pNsqGg.png" /></figure><p>TokenManagerda Sessionlarla ilgili işlem yapabilmek için de <strong>Startup.cs</strong> dosyasında bazı düzenlemeler yapmamız gerekiyor. Bunun için de <strong>ConfigureServices</strong> ve <strong>Configure</strong> metodlarının içine aşağıdaki satırları eklediğimizden emin olalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8A8aeIiYYn0zZnPIQXZ5FA.png" /></figure><p>Artık Middleware katmanımızı geliştirebiliriz fakat bu katmanda <strong>TokenManager </strong>ve <strong>FakeApiServices</strong>ı Dependency Injection ile injection işlemini yapabilmek için <strong>Startup.cs</strong> dosyasındaki <strong>ConfigureServices</strong> metoduna <strong>Singleton</strong> olarak ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AL18dG6Hh4pIJoXicoQ20Q.png" /></figure><p>Sıra geldi injection işlemini yapmaya. Bunun için Middlewarea önce interfaceleri tanımladıktan sonra <strong>Constructor</strong>a da Inject ediyoruz. Daha sonra da Constructor içinde de değer atamamızı gerçekleştiriyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZGhmgk2sKhIxDnrx6G5SLg.png" /></figure><p>Artık Middleware katmanımızın logic kısmını yazabiliriz. Her requestte Sessionda Token var mı eğer yoksa servise gidip yeni bir Token alarak onu Sessiona yazan kodumuzu da aşağıdaki gibi yazabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QMJXGXeQFQbZB5LthRdqQ.png" /></figure><p>Basitçe <strong>Middleware</strong>i bu senaryo üzerinden anlatmaya çalıştım. Umarım yararlı olmuştur.</p><p><strong>Github Linki: </strong><a href="https://github.com/yasingundogdu/MiddlewareExamples">https://github.com/yasingundogdu/MiddlewareExamples</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb349a457670" width="1" height="1" alt=""><hr><p><a href="https://medium.com/defactoteknoloji/asp-net-core-middleware-nedir-nas%C4%B1l-kullan%C4%B1l%C4%B1r-bb349a457670">ASP.NET CORE Middleware Nedir? Nasıl Kullanılır?</a> was originally published in <a href="https://medium.com/defactoteknoloji">DeFacto Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>