<?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 Emre Duman on Medium]]></title>
        <description><![CDATA[Stories by Emre Duman on Medium]]></description>
        <link>https://medium.com/@Emopusta?source=rss-4c769355c7cd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AqRsE1ASP5v1bFdo</url>
            <title>Stories by Emre Duman on Medium</title>
            <link>https://medium.com/@Emopusta?source=rss-4c769355c7cd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:48:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Emopusta/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[Authenticate to WCF SOAP Service with Both Basic Auth and 2 Way SSL in .Net Core App]]></title>
            <link>https://medium.com/@Emopusta/wcf-soap-service-2-way-ssl-in-net-core-app-ebb775c9011d?source=rss-4c769355c7cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebb775c9011d</guid>
            <category><![CDATA[two-way-ssl]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[2-way-ssl]]></category>
            <category><![CDATA[wcf]]></category>
            <category><![CDATA[soap]]></category>
            <dc:creator><![CDATA[Emre Duman]]></dc:creator>
            <pubDate>Fri, 06 Sep 2024 14:48:08 GMT</pubDate>
            <atom:updated>2024-09-09T08:53:11.528Z</atom:updated>
            <content:encoded><![CDATA[<h3>Authenticate to WCF SOAP Service with Both Basic Auth and 2 Way SSL in .Net Core App</h3><p>If you’re using the WCF BasicHttpBinding (SOAP 1.1), WSHttpBinding (SOAP 1.2), or WebHttpBinding (RESTful) to access a web service in your <strong>.Net Core </strong>applications (.Net Framework applications do not have this problem.) you might encounter that if you set the ClientCredentialType as below</p><pre>var binding = new BasicHttpBinding();<br>binding.Security.Mode = BasicHttpSecurityMode.Transport;<br>binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic</pre><p>You can not use another transport security type like Certificate or else. Because when we set the ClientCredentialType to one certain technique it avoids other security implementations.</p><p>You might think that this is a limitation because of WCF. It is not. The binding is the limitation which is why we will be using something called <strong>CustomBinding</strong>.</p><p>Before that, I tried to add an SSL certificate to headers before sending any request to other services, But as I mentioned the service works as a single ClientCredentialType so our BasicHttpBinding is not going to work with our needs.</p><p>It’s simple, all we need to do is create a CustomBinding with the given BasicHttpBinding with Basic Authentication. Then add our Certificate option as a HttpsTransportBindingElement.</p><pre>// Create BasicHttpBinding (Soap 1.1) with Basic Auth type<br>var basicBinding = new BasicHttpBinding();<br>basicBinding.Security.Mode = BasicHttpSecurityMode.Transport;<br>basicBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;<br><br>// Create custom binding with given basic binding<br>var customBinding = new CustomBinding(basicBinding);<br><br>// Add Client Certificate requireation with HttpTransportBindingElement<br>HttpsTransportBindingElement transportBindingElement = customBinding.Elements.Find&lt;HttpsTransportBindingElement&gt;();<br>transportBindingElement.RequireClientCertificate = true;<br><br>// Create your EndpointAddress<br>var uri = new Uri(&quot;Your Outer Service Url&quot;);<br>var address = new EndpointAddress(uri);<br><br>// Create your client with your binding and address<br>var client = new YourSoapClient(customBinding, address);</pre><p>Furthermore, in these configurations, all you need to do is set UserName and Password for Basic Authentication and set the Certificate you have created for your specific service.</p><pre>// Basic Auth credentials set<br>client.ClientCredentials.UserName.UserName = &quot;Basic auth username&quot;;<br>client.ClientCredentials.UserName.Password = &quot;Basic auth password&quot;;<br><br>// Certificate set<br>var certificateBytes = &quot;Your SSL Certificate in Byte Array&quot;;<br>var certificatePassword = &quot;Your SSL Certificate Password&quot;;<br>var certificate = new X509Certificate2(certificateBytes, certificatePassword);<br><br>client.ClientCredentials.ClientCertificate.Certificate = certificate;<br>// optional<br>client.ChannelFactory.Credentials.ClientCertificate.Certificate = certificate;<br><br>// Open client<br>client.OpenAsync();</pre><p>To conclude, with all of these configurations, your service should be able to send requests to outer services using both Basic Authentication and 2WaySSL.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebb775c9011d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entity-Attribute-Value Model Nedir? Nasıl Uygulanabilir?]]></title>
            <link>https://medium.com/@Emopusta/entity-attribute-value-model-nedir-nas%C4%B1l-uygulanabilir-c6ee9cd6dcc1?source=rss-4c769355c7cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6ee9cd6dcc1</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[rdbms]]></category>
            <category><![CDATA[database-design]]></category>
            <category><![CDATA[database-model]]></category>
            <category><![CDATA[entity-attribute-value]]></category>
            <dc:creator><![CDATA[Emre Duman]]></dc:creator>
            <pubDate>Fri, 15 Mar 2024 11:43:28 GMT</pubDate>
            <atom:updated>2024-03-15T11:56:59.038Z</atom:updated>
            <content:encoded><![CDATA[<p>Bir projeye başlarken eğer projenin verileri saklama ile ilgili bir ilişiği var ise belirli isterler belirlendikten sonra bu projenin veri tabanı tasarımı yapılır. Bu veri tabanlarını tasarlarken belirli modelleme yöntemleri bulunmaktadır. Tabi sizin de kendi yöntemleriniz olabilir benim de vardı ancak kullandığım yöntemlerin isimleri olduğunu öğrenene kadar. Row modelling, Serialized LOB gibi çeşitli yöntemler bulunmaktadır. Bir veri tabanında sadece bir tane yöntemi kullanacağız diye bir kural bulunmamaktadır ihtiyaca göre değişmektedir tabii ki. Bu yazıda çeşitli tasarımların arasından EAV Model’i anlayacağız.</p><p>EAV Model üç adet temel tablodan oluşmaktadır. Bu tablolar Entity, Attribute ve Value tablolarıdır. Bu tablolara ek veya paralelinde genişletilmiş tablolar eklenebilir anlatım temel üzerinden ilerleyecek ve varyasyonlara en sonda bakılacaktır.</p><h3>Entity</h3><p>Entity tablomuz aslında en üst seviye tablomuzdur. bu tabloda bizim saklayacağımız verinin en temel yapıtaşı bulunmaktadır. Örneğin bir e-ticaret sitesi düşünelim. Bu sitede kullanıcılar, ürünler, kategoriler gibi temel nesneler bu tablo altında saklanmaktadır.</p><h3>Attribute</h3><p>Bu tablomuzda ise Entity tablomuzdaki verilerin içindeki niteliklerin isimlerinin saklandığı tablo gibi düşünebiliriz. Örneğin bir kullanıcının kullanıcı adı, ismi, soyismi gibi kısımları burada saklanır. Ancak bu kısımların içerisinde değerleri tutulmaz sadece başlıklar şeklinde tutulur ve Entity tablomuzdaki oluşturduğumuz entity ile aralarında bağ kurulur.</p><h3>Value</h3><p>Value tablomuz Attribute tablomuzdaki nitelik başlıklarımızın değer verilerini tutar ve bunlar arasında bağ kurulur. Örneğin Entity tablosundaki User adlı entity’nin altında UserName adlı attribute’un value’su Emre diyebiliriz.</p><h3>Tablo Yapısı</h3><p>Tablo yapısı aşağıdaki gibidir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*3aV0p60g4YBNVIdnaov59Q.png" /></figure><p>Bu tablodan da görüldüğü üzere Hasta Emre adlı bir Entity’miz bulunmakta bu entity’nin bir adet Öksürük adlı attribute’u ve buna bağlı olarak Öksürüğün olduğunu gösteren True value’muz bulunmaktadır.</p><h3>Artıları</h3><ul><li>Dinamik bir şekilde entity ve buna bağlı attribute’ler oluşturulmasını sağlıyor.</li><li>Kullanıcıya veri tabanını dolaylı yoldan yönetebilme yeteneği kazandırıyor.</li><li>SQL veri tabanımızın NoSQL gibi davranmasını sağlar.</li></ul><h3>Eksileri</h3><ul><li>Veri tabanını okumak çok zorlaşır.</li><li>Verilerin arasındaki karmaşıklık çok yüksek düzeylere çıkabilir.</li><li>Tablolarda saklanan veri miktarı çok yükselebilir.</li></ul><h3>Tavsiyeler</h3><ol><li>Fark ettiyseniz Entity tablosunda “Hasta Emre” verisi tutulmaktadır. yeni bir hasta eklendiği zaman bu “Hasta Mehmet”, “Hasta Ahmet” gibi türeyecek ve verileri takip edip, manipüle etmek zorlaşacak. Bundan dolayı yeni bir tablo ekleyip Table “Hasta” ve Entity “Emre” gibi veya daha farklı isimlerle bu tablolar ayrılabilir. Böylece Hastalara ulaşabilmek için Entity tablosusundaki her Entity içinde Hasta stringini aramak zorunda kalmayarak sadece Table tablosundaki Hasta id’li Entityleri aramak hem veri tabanında string arama işlemlerini ortadan kaldırır hem de daha temiz ve okuması kolay bir tablo yapısı kurabilir.</li><li>Value tablosu birden çok Value türüne bölünebilir yukarıdaki örnekte sadece string değerler için oluşturulmuş bir tablo bulunmakta buna ek olarak int, bool, decimal gibi ayrı Value tabloları eklenebilir ancak bu yöntem karmaşıklığı arttıracaktır.</li></ol><h3>Sonuç</h3><p>Bu yöntem ilişkisel veri tabanını (RDBMS) NoSQL gibi davranmasını sağlamaktadır. Karmaşıklığı yüksek miktarda arttırıp, okunabilirliği azaltmaktadır. İlişkisel veri tabanı kullanımı şartı olmayan projelerde eğer yatayda ölçeklenebilir bir tasarıma ihtiyacınız var ise NoSQL kullanmak işinizi kolaylaştıracaktır.</p><h3>Referanslar</h3><ul><li><a href="https://github.com/Emopusta/EAVModelExample">https://github.com/Emopusta/EAVModelExample</a></li><li><a href="https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model">https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model</a></li><li><a href="https://medium.com/@yegorshytikov/magento-eav-database-architecture-20b25c09af98">https://medium.com/@yegorshytikov/magento-eav-database-architecture-20b25c09af98</a></li><li><a href="https://medium.com/@deepak.mallah/how-eav-data-model-helped-us-36c7c765d7e3">https://medium.com/@deepak.mallah/how-eav-data-model-helped-us-36c7c765d7e3</a></li><li><a href="https://medium.com/@kamalmeet/eav-flexible-rdbms-schema-f7911d662ac0">https://medium.com/@kamalmeet/eav-flexible-rdbms-schema-f7911d662ac0</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6ee9cd6dcc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FluentValidation ile Business işlemleri]]></title>
            <link>https://medium.com/@Emopusta/fluentvalidation-ile-business-i%C5%9Flemleri-0510ff6008e7?source=rss-4c769355c7cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/0510ff6008e7</guid>
            <category><![CDATA[fluentvalidator]]></category>
            <category><![CDATA[fluent-validation]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[validation]]></category>
            <dc:creator><![CDATA[Emre Duman]]></dc:creator>
            <pubDate>Mon, 26 Feb 2024 10:50:18 GMT</pubDate>
            <atom:updated>2024-02-26T10:54:48.152Z</atom:updated>
            <content:encoded><![CDATA[<p>Bu yazıda bir .net backend projesinde FluentValidation kullanarak sadece validation işlemlerinin yanı sıra FluentValidation ile repository çağırdığımız bir iş (business) işlemi de yapılabileceğini göreceğiz.</p><p>İlk olarak örnek bir validation kodunu aşağıda görebiliriz.</p><pre>public class CreateProductCommandValidator : AbstractValidator&lt;CreateProductCommand&gt;<br>{<br>    public CreateProductCommandValidator()<br>    {<br>        RuleFor(c =&gt; c.Name).NotEmpty();<br>    }<br>}</pre><p>Bu kodda görüldüğü üzere bir Product entity oluşturan command’ı gösteren bir validator sınıfı. Bu validator Product oluşturulurken kullanılan Name alanının boş olmamasını koşul yapan ve boş ise validation exception atan bir kod bloğu. Gördüğümüz üzere bu temel bir FluentValidation implementasyonu ancak bahsettiğim üzere bunun devamı olacak yani iş kodumuzu da burada yazabileceğiz.</p><p>Aşağıdaki koda bir göz atalım.</p><pre>public class DeleteProductCommandValidator : AbstractValidator&lt;DeleteProductCommand&gt;<br>{<br>    private readonly IGenericRepository&lt;Product&gt; _productRepository;<br><br>    public DeleteProductCommandValidator(IGenericRepository&lt;Product&gt; productRepository)<br>    {<br>        _productRepository = productRepository;<br><br>        RuleFor(c =&gt; c.ProductId)<br>            .MustAsync(ProductMustExist).WithMessage(ProductBusinessMessages.ProductMustExist);<br>    }<br><br>    private async Task&lt;bool&gt; ProductMustExist(int productId, CancellationToken cancellationToken)<br>    {<br>        return (await _productRepository.GetAsync(p =&gt; p.ProductId == productId)) != null;<br>    }<br>}</pre><p>Koddan da anlaşılacağı üzere Product entity silme işlemi yapan bir command’ı görmekteyiz. Bu command içerisinde doğal olarak silinecek olan product’ın id si bulunmaktadır ve business kodumuz da bu id için veri tabanında bir veri var mı diye kontrol etmektedir. Bu bir örnek kod olduğu için kodun amacını sorgulamayalım. Görüldüğü üzere Product Repository mizi injectliyoruz. Ardından validationumuza başladıktan sonra MustAsync() içerisine iş fonksiyonumuzu gönderiyoruz ve ardından fonksiyonumuzdan yapılan dönüşümüze göre WithMessage() ile özel bir ValidationException mesajı döndürebiliyoruz.</p><p>Bu şekilde FluentValidation içerisinde sadece validationlarımızı değil, iş kodlarımızı da yazabiliyoruz.</p><p><strong>Referanslar</strong></p><p><a href="https://github.com/Emopusta/adessibinden">https://github.com/Emopusta/adessibinden</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0510ff6008e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Differences between AddSingleton, AddTransient, and AddScoped.]]></title>
            <link>https://medium.com/@Emopusta/differences-between-addsingleton-addtransient-and-addscoped-93646cfa435c?source=rss-4c769355c7cd------2</link>
            <guid isPermaLink="false">https://medium.com/p/93646cfa435c</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[addscoped]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[addsingleton]]></category>
            <category><![CDATA[addtransient]]></category>
            <dc:creator><![CDATA[Emre Duman]]></dc:creator>
            <pubDate>Wed, 15 Nov 2023 10:32:28 GMT</pubDate>
            <atom:updated>2023-11-15T10:32:28.885Z</atom:updated>
            <content:encoded><![CDATA[<p>To begin with this blog, you need preknowledge about Dependency Injection. To remind you DI, if you call a service or a class from another place and call it with ClassName service = new(); it will be wrong with the SOLID principles. You need to inject that class into your current class with dependency injection. After injection, the program doesn’t know which class was injected because we are using abstraction during the injection. To introduce what class has been used on that interface we are using IoC. There are a bunch of IoC technologies exist like Autofac, etc.</p><p>After the basic introduction of Dependency Injection, we can continue with AddSingleton.</p><pre>AddSingleton&lt;IProduct, Product&gt;();</pre><p>In AddSingleton, we see that the IProduct interface is called, and it acts like a Product. “AddSingleton” means that whenever your program builds and runs, it creates a single instance of the service and it lives until the application ends.</p><pre>AddScoped&lt;IProduct, Product&gt;();</pre><p>In AddScoped, with every HTTP request, it generates an instance of it and disposes after the end of the request.</p><pre>AddTransient&lt;IProduct, Product&gt;();</pre><p>In AddTransient, the service instance is provided on every request. It means if different classes call the same service there will be a duplication of instances because on every request it provides a new service instance.</p><p>At the end, we have explained three different service instance providers and you can manage your project needs for efficiency. If your project needs a single reusable instance and use it until the end of the program use AddSingleton, else if you don’t want to use too many resources, and for every HTTP request you want to create a related service instance you can use AddScoped, or else you are calling an instance very rarely and it doesn’t need to provide very often you can use AddTransient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93646cfa435c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>