<?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 Yildiraygemuk on Medium]]></title>
        <description><![CDATA[Stories by Yildiraygemuk on Medium]]></description>
        <link>https://medium.com/@yildiraygemuk?source=rss-97779c53ec24------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jTAulDdG9X6URCNRWx_Kgg.jpeg</url>
            <title>Stories by Yildiraygemuk on Medium</title>
            <link>https://medium.com/@yildiraygemuk?source=rss-97779c53ec24------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:29:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yildiraygemuk/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[The Synergy of Machine Learning and .NET: The Innovative Role of ML.NET]]></title>
            <link>https://medium.com/@yildiraygemuk/the-synergy-of-machine-learning-and-net-the-innovative-role-of-ml-net-d0ce9bc75906?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0ce9bc75906</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlnet]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 18:58:20 GMT</pubDate>
            <atom:updated>2023-12-18T18:58:20.847Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Synergy of Machine Learning and .NET: The Innovative Role of ML.NET</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*tIiEpMxBCPDrZTenLBrRGg.jpeg" /></figure><p>In today’s rapidly advancing technological landscape, machine learning (ML) has evolved from a sci-fi fantasy to a vital part of our everyday lives. Microsoft’s ML.NET library, developed on the .NET platform, offers unparalleled opportunities for developers wanting to enter this field. This article explores the basics of ML.NET and its real-world applications. ML.NET is an open-source machine learning library developed by Microsoft. It enables .NET developers to create machine learning models using languages like C# or F#. This library supports various ML tasks such as classification, regression, clustering, and anomaly detection, and can be easily integrated into existing .NET applications.</p><h3>Getting Started: Installation and First Steps</h3><p>To begin with ML.NET, the .NET Core SDK must be installed. In Visual Studio or other development environments, you can easily start by adding the ML.NET NuGet package to your project. When creating an ML.NET project, you follow steps like defining the data model, processing the data, training the model, evaluating and testing the model, and finally, using the model in your application.</p><p>The power of ML.NET is best demonstrated through real-world examples:</p><blockquote><strong>Analysis of Customer Reviews in E-Commerce:</strong> On online shopping platforms, analyzing data from customer reviews can determine the overall satisfaction level of products. This is critical for improving customer satisfaction and enhancing the product range.</blockquote><blockquote><strong>Disease Diagnosis in Healthcare:</strong> We can develop models that assist in the early diagnosis of diseases using patients’ symptoms and laboratory results. This supports doctors’ decision-making processes and improves patient care quality.</blockquote><blockquote><strong>Credit Risk Analysis in Finance:</strong> Banks can use machine learning models to assess the repayment capabilities of customers applying for credit. These models analyze data like credit history and income status to minimize lending risks.</blockquote><p>ML.NET offers advanced features like hyperparameter tuning and model optimization, allowing developers to further refine their models. Additionally, integration with cloud platforms like Microsoft Azure enables easy deployment and use of developed models on the cloud. The future of machine learning is bright, and ML.NET will continue to contribute significantly to this field for .NET developers. With evolving algorithms and increasing data accessibility, I foresee an expansion in the application areas of ML.NET.</p><p>ML.NET offers powerful and flexible solutions for .NET developers in the world of machine learning. The examples and information discussed in this article can serve as a starting point for developers venturing into this exciting field. Machine learning has the potential to shape not just the world of technology but our daily lives, and ML.NET is an excellent tool for exploring this potential.</p><p>As we have seen, ML.NET opens a new horizon in machine learning for .NET developers, offering a seamless blend of accessibility and power. Its ability to integrate into existing .NET applications makes it not just a tool for machine learning specialists, but also a gateway for every developer to incorporate advanced data analysis and predictive modeling into their solutions. Whether it’s enhancing customer experiences in e-commerce, advancing diagnostic procedures in healthcare, or refining risk assessment in finance, ML.NET stands as a testament to how machine learning can be harnessed to not only innovate but also to enrich our daily lives. With the continuous evolution of technology and data science, ML.NET is poised to play a pivotal role in shaping the future of automated solutions and intelligent applications. As developers and innovators, we stand on the cusp of a new era of technological advancement, where the integration of machine learning with traditional software development can lead to unprecedented possibilities and breakthroughs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0ce9bc75906" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minimal APIs in .NET]]></title>
            <link>https://medium.com/@yildiraygemuk/minimal-apis-in-net-c8e4ac5e17e7?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8e4ac5e17e7</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[minimal-api]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Wed, 05 Jul 2023 15:08:20 GMT</pubDate>
            <atom:updated>2023-07-05T15:08:20.999Z</atom:updated>
            <content:encoded><![CDATA[<h3>Minimal APIs in .NET</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*Zyu_pDFtWbUY5S3pyJKncg.png" /></figure><p>With the release of .NET 6, Microsoft introduced a new feature called Minimal APIs. Minimal APIs provide a streamlined and lightweight approach to building web applications with .NET. They aim to simplify the development process by reducing the amount of code and configuration required, while still maintaining the power and flexibility of the .NET framework. In this article, we will explore what Minimal APIs are, their benefits, and provide examples to demonstrate their usage.</p><p>What are Minimal APIs?</p><p>Minimal APIs in .NET enable developers to create web applications using a minimalistic approach. Traditionally, building web applications with .NET involved creating controllers, routes, and configuring various middleware. Minimal APIs eliminate the need for these components, allowing developers to define routes and handle requests using a single file.</p><h3>Benefits of Minimal APIs</h3><h3>1. Simplicity and Readability</h3><p>Minimal APIs simplify the code structure by eliminating the need for multiple files and configurations. With a single file, developers can define routes, handle requests, and perform other necessary tasks. This approach enhances code readability and makes it easier to understand and maintain the application.</p><h3>2. Reduced Development Time</h3><p>By eliminating the boilerplate code and configuration, Minimal APIs significantly reduce development time. Developers can focus on writing business logic rather than dealing with infrastructure setup. This leads to faster development cycles and increased productivity.</p><h3>3. Lightweight Applications</h3><p>Minimal APIs result in lightweight applications as they reduce the number of dependencies and overhead. This leads to improved performance and scalability, making it ideal for microservices and serverless architectures.</p><h3>4. Easy Migration and Adoption</h3><p>Minimal APIs can be gradually adopted in existing .NET applications. Developers can start by converting specific routes or controllers to Minimal APIs, gradually migrating the entire application. This flexibility allows teams to embrace Minimal APIs at their own pace without disrupting their existing codebase.</p><h3>Examples of Minimal APIs</h3><p>Let’s explore a couple of examples to showcase the simplicity and power of Minimal APIs.</p><h3>Example 1: Hello World</h3><blockquote>var builder = WebApplication.CreateBuilder(args);</blockquote><blockquote>var app = builder.Build();</blockquote><blockquote>app.MapGet(“/”, () =&gt; “Hello, World!”);</blockquote><blockquote>app.Run();</blockquote><p>In this example, we create a Minimal API that responds with “Hello, World!” when a GET request is made to the root (“/”) route. The WebApplication.CreateBuilder method initializes the application, app.MapGet defines the route and response, and app.Run starts the application.</p><h3>Example 2: Weather Forecast API</h3><blockquote>var builder = WebApplication.CreateBuilder(args);</blockquote><blockquote>var app = builder.Build();</blockquote><blockquote>app.MapGet(“/weather”, () =&gt;<br>{<br> var rng = new Random();<br> var temperatures = Enumerable.Range(1, 5)<br> .Select(index =&gt; new WeatherForecast<br> {<br> Date = DateTime.Now.AddDays(index),<br> TemperatureC = rng.Next(-20, 55),<br> Summary = Summaries[rng.Next(Summaries.Length)]<br> })<br> .ToArray();</blockquote><blockquote>return temperatures;<br>});</blockquote><blockquote>app.Run();</blockquote><blockquote>public record WeatherForecast<br>{<br> public DateTime Date { get; init; }<br> public int TemperatureC { get; init; }<br> public string Summary { get; init; }<br>}</blockquote><p>In this example, we create a Minimal API that generates a weather forecast for the next five days when a GET request is made to the “/weather” route. The forecast is randomly generated using the WeatherForecast record and returned as JSON.</p><h3>Downsides of Minimal APIs</h3><p>While Minimal APIs offer several benefits, it’s important to consider their limitations as well.</p><h3>1. Reduced Flexibility</h3><p>Minimal APIs provide a simplified approach, but they may not be suitable for complex scenarios that require advanced customization and configuration. In such cases, traditional controllers and routing may be a better fit.</p><h3>2. Learning Curve</h3><p>Adopting Minimal APIs requires developers to familiarize themselves with the new approach and its conventions. Teams with extensive experience in traditional .NET web development may need to invest time in learning and adapting to this new paradigm.</p><h3>Conclusion</h3><p>Minimal APIs in .NET offer a streamlined and lightweight approach to building web applications. With their simplicity, reduced development time, and lightweight nature, they provide a powerful toolset for creating efficient and scalable applications. However, it’s essential to evaluate the suitability of Minimal APIs for your specific project requirements before adopting them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8e4ac5e17e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is OData?]]></title>
            <link>https://medium.com/@yildiraygemuk/what-is-odata-219ae50fc28e?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/219ae50fc28e</guid>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[rest]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[odata]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Sun, 21 Aug 2022 21:41:35 GMT</pubDate>
            <atom:updated>2022-08-21T21:41:35.397Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, today we will look for answers to the questions of what is Odata and how to use it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*H0mRYeETkav9xTkRHFc1Rw.png" /></figure><p><strong>What is OData?</strong></p><ul><li>OData is a REST based protocol for querying and updating data. It is built on technologies such as HTTP, ATOM/XML and JSON.</li><li>With the Web Api project created on the OData protocol, you can use the Odata URI structure to make the query you want through the database you connect to, or you can perform the update and deletion (crud) operations.</li></ul><p><strong>What are the advantages?</strong></p><ul><li>Since it is an http-based service, it makes all queries on the data via the url.</li><li>Mobile platforms can also be used.</li><li>Since we will be pulling filtered data, it makes it advantageous in terms of performance.</li><li>It offers the possibility to create a service to our data model very quickly.</li><li>We can easily make restrictions on the service.</li></ul><p><strong>OData Data Model</strong></p><ul><li>The OData Data Model is a server-side model; this indicates that the dataset is only available on the server and the client knows the currently visible data. That is, the desired query operations are done on the server. The client sends a query request to the server and displays the returned data.</li><li>Another important feature of the model is the OData metadata document. It defines the Entity Data Model (EDM) for a particular service, which is the abstract data model used by OData services to shape the description of the resources it exposes.</li></ul><p><strong>OData Protocol</strong></p><ul><li>This allows the client to make requests and get an OData server response. This includes CRUD operations and OData-defined query language. An OData service can be represented in an XML-based format or JSON defined by Atom and AtomPub.</li></ul><p><em>If that’s enough information, let’s take a look at how we can use it.</em></p><blockquote><strong>$filter=(Id eq 11) or (Id eq 22) or (Id eq 33)</strong></blockquote><blockquote>We say list those whose Id value is 11, 22 or 33, and if we use and instead of or, we will be waiting for records that match more than one filter condition we wrote.</blockquote><blockquote><strong>$count=true</strong></blockquote><blockquote>You should use it to get the number of records returned for the room query you wrote in a separate feature.</blockquote><blockquote><strong>$orderby</strong></blockquote><blockquote>The example syntax for parameters to be used for sorting is as follows.</blockquote><blockquote><strong>$expand=Category</strong></blockquote><blockquote>We use the $expand command to get values from other related classes marked with virtual in the Entity.</blockquote><blockquote><strong>$filter=Id eq 16&amp;$expand=ProductItems</strong></blockquote><blockquote>Returns a ProductItems(which is a virtual-marked <strong>ICollection&lt;T&gt;</strong> object) with an Id value of 16 of type Array.</blockquote><blockquote><strong>$expand=ProductItem($expand=Product)</strong></blockquote><blockquote>This is the syntax to use for the $expand event on nested objects.</blockquote><p>Thanks for reading.</p><p><em>You can reach a wide range of official examples about OData from https://github.com/OData/ODataSamples repo.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=219ae50fc28e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is SQL Injection, How to Prevent it?]]></title>
            <link>https://medium.com/@yildiraygemuk/what-is-sql-injection-how-to-prevent-it-4fcbaf2a85f2?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fcbaf2a85f2</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[sql-injection]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[entity-framework-core]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Thu, 04 Aug 2022 18:15:32 GMT</pubDate>
            <atom:updated>2022-08-04T18:15:32.405Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*29v0UOgQagqrrSftGmm8jA.png" /></figure><p>If you ask <strong>what is SQL injection</strong>, the answer to the method of unauthorized access to the data in the database by interfering with the <strong>SQL query</strong> made by the web application will be appropriate. This vulnerability allows viewing data that would otherwise be impossible to see.</p><p>When a customer enters the system, he/she gives his/her user name and password and gets access. This permission only authorizes you to see your own data. In the SQL injection method, however, an attacker can access other users and other data of the web application. With the SQL injection vulnerability here, the attacker can transfer, modify, delete data. In other words, it becomes able to manipulate all the data it accesses.</p><p>This vulnerability, which we encounter in web-based applications, is one of the most basic methods used by data thieves. When filling out any form on a website, a SQL query is passed to the database in the background. Here, a communication with the database is established. If the security measures that will be mentioned shortly are not taken, the database becomes open to manipulation with a different SQL query from the same communication channel. In this case, called SQL injection vulnerability, your data is easily transferred to another place.</p><p><em>Let’s explain this with examples;</em></p><p>In some cases, we may have to keep a raw Sql query on the code side. I will show this situation with a method below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OS6psiwFsdc5jqlt-ICDfw.png" /></figure><p>Here, the string value from the parameter is directly included in the query. Well, let’s see what happens if we use it this way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AbF6lc9ITHK5tCf2pIuJFw.png" /></figure><p>As you can see above we have a list that lists data from SQL and a filter that searches. We will filter by name.</p><p>When we search for the ‘<strong>kalem</strong>’ value here, our query will run and there will be no problem.<br>But malicious users write such a SQL query here that they can bring all your data to this list. It can even update and delete all your data. Now let’s see how we can print all the data to this list with a simple code.<br>At the same time, I will use Sql Server Profiler to capture incoming requests to Sql server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*c5FVAlN4VJqXSzQWqWS2IQ.png" /></figure><p>When we query the word ‘<strong>kalem</strong>’, the query made to Sql is as above.So, let’s look at how a security vulnerability can occur;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGnL7y1IpriNOo40njI9Dg.png" /></figure><p>If we enter a data like &quot;<strong> &#39; OR &#39;1&#39; = &#39;1&#39; -- </strong>&quot; in the input field. We wrote single quotes, left a space, and used the <strong>OR </strong>keyword. Then we equated <strong>1 to 1</strong> and commented out to ignore any subsequent codes. This way we closed the first query and in the next query we set <strong>1 to 1</strong> and set the where condition to true. In this way, all our data has been exposed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*E75s2ma6xZVXveydkw_RqA.png" /></figure><p>The query to the SQL side is as above. This is the simplest SQL injection tactic. And this query returns all your data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*bFUGOQTc-m4sAt8ODAlw7w.png" /></figure><p>If we had used the entity framework and had prepared the query as I showed above, we would not have encountered this problem.</p><p>When we query with Entity Framework, a request goes to the Sql server as follows. Entity Framework prevented malicious user from trying to get all data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QgeUYxhyscEjao4taiqm0g.png" /></figure><p><em>So, if I still have to write a raw SQL query, how can I avoid this vulnerability?</em></p><p>When we prepare the request as below, SqlInterpolated will take the ‘<strong>searchText</strong>’ here as Sql parameter and protect us against sql injection vulnerability</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i63bMSDRKP8HWd6q6yorew.png" /></figure><p><em>Of course, this is not the only method, we can get rid of </em><strong><em>SQL injection </em></strong><em>vulnerability in this way.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDkxgcUB4wyxvvvH3rkx1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*84xUfEZyMBD7HDqBvOEXUg.png" /></figure><p>Since our query will reach the Sql server in this way, it will not be exposed to a security vulnerability.</p><p>Today I tried to explain with you what SQL injection is and how we can protect it. I hope it was useful. Waiting for your comments!<br>See you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fcbaf2a85f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with the Fetch API]]></title>
            <link>https://medium.com/@yildiraygemuk/working-with-the-fetch-api-5aaaad20a151?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/5aaaad20a151</guid>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 20:31:19 GMT</pubDate>
            <atom:updated>2022-07-20T20:31:19.012Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you are reading this article, the question in your mind is probably “What does this </em><strong><em>fetch API</em></strong><em> do?”</em></p><p>In fact, what we can do with the fetch API is to process data after it comes from a server.<br>So what does this mean?</p><p><em>Let’s think like this;</em></p><p>We went to a restaurant we want to order and the person we ordered took our order. And if we continue to wait in front of the cash register after receiving it, we will prevent the next person from ordering.<br>Perhaps the next person’s order was much faster. And since he would get a much faster response, he actually had to get it earlier, but we blocked it.<br>And one thing we should not forget is that after we order at the checkout, we want to go and buy these products “after they are prepared”. However, one of the new concepts that comes with fetch says, “<em>Yes, I promised this, now I will try it and if everything is fine, I will deliver it to you</em>.”</p><p>It allows us to receive and send data asynchronously as an alternative to Ajax. It is an async structure because it is based on Promise. It’s a feature that comes with Promise ES6. We can use it instead of callback functions. By using the promise structure in Fetch API, it offers a structure that we can use instead of Ajax. It also comes with the Fetch API window object. If we print the window object in the console, you can see the fetch method under this window object.</p><blockquote><strong>Fetch Interfaces</strong></blockquote><blockquote><strong>fetch()</strong> - this method is used to get a resource.</blockquote><blockquote><strong>Headers</strong> - represents response/request headers, allowing you to query them and take different actions depending on the results.</blockquote><blockquote><strong>Request</strong> - represents a resource request.</blockquote><blockquote><strong>Response -</strong> represents the response to a request.</blockquote><p>To use the Fetch API, we need to write the url that we will request to the fetch method as a parameter. After the fetch() method, the then() promise method is added to the end of the method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*shcT0i_5zr99JQ-U6JQIrg.png" /></figure><p>For example, let’s make a <strong>get request</strong> to the address “<a href="https://jsonplaceholder.typicode.com/todos">https://jsonplaceholder.typicode.com/todos</a>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*xiThbO9rJU4Y4FBHHm4FPw.png" /></figure><p>let’s make a <strong>post request</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*pm7oNToYbZgLZah8jtrV8g.png" /></figure><p>The step-by-step fetch().then().then().catch() structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*B_wPVegT45BguLdN7IKVUg.png" /></figure><p><strong><em>So how does this code block work?</em></strong></p><p>When we make a fetch request, it calls the then function.<br>If everything goes well, the incoming data comes to us as a response in then. And we take the response as a parameter, we use the <strong>.json()</strong> <strong>method</strong> to get the json content.<br>This time inside the <strong>then()</strong> <strong>method</strong>, we wrote a function that will take the result from the previous method and display it in the console. This function takes a parameter named todos and we get the todos.title value from each todos with the help of the forEach method and print it to the console.<br>And finally, if an error occurs at any stage with the <strong>catch()</strong> <strong>method</strong>, we take this error as a parameter and print it to the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*r_heuDD7ZHgnF3vCMWi3uw.png" /></figure><p>Thank you for giving a time. Waiting for your ideas and comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5aaaad20a151" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Method Idempotence?]]></title>
            <link>https://medium.com/@yildiraygemuk/what-is-method-idempotence-cfedf2c0194d?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfedf2c0194d</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[idempotency]]></category>
            <category><![CDATA[queue]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Wed, 11 May 2022 19:57:16 GMT</pubDate>
            <atom:updated>2022-05-11T19:57:16.991Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b6VfOSSDLBK_S-IGor9q1w.png" /></figure><p>If a method is called once and the result is the same when it is called more than once, it is an idempotent method.</p><p>We can exemplify this method for use in payment systems. For example, when the payment received once is repeated in the same way, this request will not be processed without going through an approval mechanism.</p><p>Let’s explain this with a simple example;</p><p>public void firstMethod(){<br>i = 20;<br>}</p><p>public void secondMethod(){<br>i = i + 1;<br>}</p><p>Once the “<strong>firstMethod</strong>” method is called, the value of the variable “i” will be 20. The result will not change when we are called once again.</p><p>When the “<strong>secondMethod</strong>” method is called once, the value of the “i” variable will be one more time. For example, if the initial value of “i” is 20, the first time we call it, its value will be 21. If we call it once again, the value of “i” will be 22.</p><p>In this case, the “<strong>firstMethod</strong>” method is idempotent, and the “<strong>secondMethod</strong>” method is the non-idempotent method.</p><p>Let’s examine this situation in terms of <strong>HTTP methods</strong>.</p><p><strong>HTTP methods</strong><br>They are <strong>GET</strong>, <strong>POST</strong>, <strong>PUT</strong> and <strong>DELETE </strong>methods. Apart from these, there are other methods. But we will only dwell on the most well-known methods.</p><p>For example, let’s have the following three records in our database.<br>‘id’:’1&#39;, ‘name’:’Yildiray’, ‘surname’:’Gemuk’<br>‘id’:’2&#39;, ‘name’:’Elon’, ‘surname’:’Musk’</p><p><strong>GET</strong><br>When we send a request like /users/1 to the server, the record with id 1 will be returned. Repeating this request more than once will not change the result. Therefore, GET is an <strong>idempotent</strong> method.</p><p><strong>PUT</strong><br>/users/1<br>body: {‘name’:’Bill’, ‘surname’:’Gates’}</p><p>When we send a request like above to the server, Yildiray Gemuk expression will be updated as Bill Gates. When we send the request one more time, there will be no change when the value in the database is Bill Gates. This is also an <strong>idempotent </strong>method.</p><p><strong>DELETE<br></strong>/users/1</p><p>When we send a request to the server as above, the record with id 1 will be deleted. When we call the relevant request again, no action will be taken because there is no record with an id of 1. This is also an <strong>idempotent </strong>method.</p><p><strong>POST<br></strong>/users<br>body: {‘name’:’David’, ‘surname’:’Beckham’}</p><p>When we send a request like above to the server, a record like {‘id’:’3, ‘name’:’David’, ‘surname’:’Beckham’} will be created. If we call the relevant request one more time, another record will be created as {‘id’:’4&#39;, ‘name’:’David’, ‘surname’:’Beckham’}. That is, the more times we call, the more new records will be created. Therefore, <strong>POST </strong>is a <strong>non-idempotent</strong> method.</p><p>Cache the Results of <strong>GET </strong>Requests<br>When you send a <strong>GET </strong>request, the server caches the relevant result. Later, when the same <strong>GET</strong> request comes, the cached result is returned.</p><p>Finally, when the refresh process is performed on web browsers, before the page is loaded, if the relevant method is non-idempotent, the relevant request has been sent before and asks us for confirmation to run the method again. This confirmation mechanism prevents us from running non-idempotent methods more than once outside of our control.</p><p>If you have anything to add or feedback, feel free to leave a comment. I hope it was useful. See you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfedf2c0194d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are the differences between .Net 5 and .Net 6?]]></title>
            <link>https://medium.com/@yildiraygemuk/what-are-the-differences-between-net-5-and-net-6-fd7cd78fbde8?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd7cd78fbde8</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[program]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Thu, 21 Apr 2022 14:03:46 GMT</pubDate>
            <atom:updated>2022-04-21T14:03:46.417Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are the differences between .Net 5 and .Net 6?</h3><p>First of all, I don’t think that there is a radical change in <strong>.Net 6</strong> structurally. Incoming changes focused on the simplicity, practicality and speed of building the code.</p><p>In order to use <strong>.Net 6</strong>, you need to install <strong>Visual Studio 2022</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*qgB808VFWJnTm0DK3mA2RQ.png" /></figure><blockquote><strong>Startup</strong></blockquote><h4><strong>Startup file removed in .Net 6!</strong></h4><p>What was the <strong>Startup</strong>? It was the file where we made the basic configurations of our application. While configuring the services to be used in an application in “<strong>ConfigureServices</strong>”, we were providing the necessary middleware calls in “<strong>Configure</strong>”.</p><p>But in <strong>.Net 6</strong> we are told that we should do these in <strong>Program.cs</strong>, not in <strong>Startup</strong>.</p><p>Because we were already reporting the configurations we made in <strong>Startup </strong>in <strong>Program.cs</strong>, and .Net 6 rightly deems this unnecessary. You will call the configuration you have already made in a different class in <strong>Program.cs</strong>. Instead of doing this, he says, just provide these configurations in <strong>Program.cs</strong> with simple and work in a single file.</p><blockquote><strong>Top Levet Statements</strong></blockquote><p>In .Net 6, Top Level Statements feature comes by default.</p><p>In the <strong>Top Level Statements</strong> feature, code can be written in Program.cs and this code is considered written in the main method. In this way, we do not overwhelm the application with Scopes and Namespaces unnecessarily. The application can focus purely on the code it will process. When we look at previous versions;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*rXpqfaJhrN9uefxPjvXbtw.png" /></figure><p>As we saw above, there is a very crowded structure such as using, namespace, name.</p><p>Let’s take a look at <strong>.Net 6</strong>;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*w_DQ7uTTrnWAdQLxbDYrbw.png" /></figure><p>As we saw above, it is focused on simplifying the codes and only on the code. In this way, the Top Level Statements feature comes by default.</p><blockquote><strong>WebApplicationBuilder</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*jpF2VHEH662jeTiNwZQrzA.png" /></figure><p>As you can see above, in versions prior to .Net 6, we had to create a host to launch the application. “<strong>CreateHostBuilder</strong>” takes the responsibility and returns an Interface of type “<strong>IHostBuilder</strong>”. In order to return this Interface, the “<strong>CreateDefaultBuilder</strong>” method is called from the “<strong>Host</strong>” class. This returns us an object, and we call a StartUp file through this object, where we can call how much configuration there is in the application, bla bla..</p><p>Finally, we Build them, then Run them and the application stands up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*4kqutoXtltl-bUpJGXgB9g.png" /></figure><p>In .Net Core 6 you see above, we use the “<strong>WebApplication</strong>” class. In previous versions, we used the “<strong>Host</strong>” class to create “<strong>IHostBuilder</strong>”.</p><p><em>The services to be used in the application can be integrated with the builder here.</em></p><p>After the application is built, an object containing the instances related to the services I have installed returns. And this object is <strong>WebApplication</strong>.</p><p>Briefly;</p><p>If we were to ask what is the main difference in the host configuration between .Net 5 and .Net 6,</p><blockquote><strong>WebApplication </strong>and <strong>WebApplicationBuilder </strong>configurations have arrived in .Net 6. In previous versions, <strong>WebApplication </strong>is used instead of <strong>IHost </strong>and <strong>WebApplicationBuilder </strong>is used instead of <strong>IHostBuilder</strong>.</blockquote><p>But their basic mission is the same. We build with Build and use this built app with builder.</p><p>Of course, not all innovations are like that. I will talk about other innovations in future articles. I hope I was descriptive and instructive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd7cd78fbde8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How can we easily convert Json or XML format to class with Visual Studio?]]></title>
            <link>https://medium.com/@yildiraygemuk/how-can-we-easily-convert-json-or-xml-format-to-class-with-visual-studio-f40eb67f1d8e?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/f40eb67f1d8e</guid>
            <category><![CDATA[xml]]></category>
            <category><![CDATA[class]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Sat, 09 Apr 2022 22:04:56 GMT</pubDate>
            <atom:updated>2022-04-09T22:04:56.596Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone!</p><p>Today, we will talk about how we can easily convert Json or XML format to class with Visual Studio.</p><p>Previously, we could do this by writing ourselves or thanks to websites that convert Json format to Class or other formats.<br>But did you know you can do this from within Visual Studio?</p><p>Let’s find out then;</p><p>First we copy our Json or XML data. I will go over Json in our example, but you can repeat the same steps for XML.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*bPNbr2ziJRqjHpxQ6nfyRw.png" /></figure><p>Then, by following the steps below, you choose the Json as Classes option if our data is in Json format, and the XML as Classes option if it is in XML format.<br><strong><em>Edit — Paste Special — Paste JSON As Classes</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*2xUjUVwoPrjNszz1PJJpKw.png" /></figure><p>And our class is easily created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*LELh_fp3CF4NKjjDHCt_AA.png" /></figure><p>Thank you for taking the time to read!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f40eb67f1d8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Domain Driven Design (DDD)?]]></title>
            <link>https://medium.com/@yildiraygemuk/what-is-domain-driven-design-ddd-cfbd7a5e5546?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfbd7a5e5546</guid>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[ddd]]></category>
            <category><![CDATA[domain-driven-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Sun, 27 Mar 2022 19:32:01 GMT</pubDate>
            <atom:updated>2022-03-27T19:32:01.346Z</atom:updated>
            <content:encoded><![CDATA[<p>Domain Driven Design is an approach that helps us solve and manage the complexity in our project, and also allows us to make our project sustainable. The complexity in our project is actually a lot of business rules in our project.</p><h3>What are the Usage Purposes of Domain Driven Design?</h3><p>Since there may be too many business rules in services consisting of a microservice responsible for the basket, a microservice responsible for billing processes and similar structures, we can use this approach to manage the complexity here and make our codes sustainable.</p><p>However, such as Instagram, only adding photos, deleting likes, or a blog site, etc. It is unnecessary to use the DDD approach, as there will not be many business rules in the structures. Because adding articles, listing articles etc. There is not much complexity as CRUD operations occur, and yet if you use DDD you will actually complicate your code unnecessarily. But if we think about creating an invoice, too many business rules may have been implemented during the creation of that invoice, and DDD would be the right approach to get rid of the complexity of the transactions here.</p><h3>Ubiquitous Language</h3><p>We can think of this concept as a ubiquitous common language. So let’s evaluate the importance of this through a scenario;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*Hli4Q7-eSmvLwhC7hQOJ3Q.jpeg" /></figure><p>Let’s consider an invoice generation service. If we consider the <strong>red part</strong> in the picture above as a table; Domain Expert on the left, the expert person who has knowledge about creating invoices and making invoice transactions, and the expert person on the right who knows how to do this in the software part. According to DDD, these two friends should use the common language. So if we give an example; What the person at Domain Expert calls a <strong>invoice</strong>, the person at Development shouldn’t call it a <strong>receipt</strong>. Both should use a common language.</p><h3>Bounded Context</h3><p>They are structures where we logically group the parts within a main domain (such as e-commerce) and bring them together according to their interests. If we go through an e-commerce system;</p><p>In the e-commerce system;</p><ul><li>Stock management</li><li>Order management</li><li>Payment method</li><li>Product management</li><li>Customer management</li></ul><p>There are fields that are related to each other. We call each of these interrelated fields bounded context.</p><h3>Bounded Context Architectural Structure</h3><p>The Onion Architecture structure is used as the structure. In the picture below, we consider each ring as a layer, and the communication of these layers with each other is from the inside out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*M_C0PlYOugcdTUFWgiWojg.jpeg" /></figure><p><strong>Entity :</strong> These are structures that have a unique value of their own.</p><p><strong>Value Object : </strong>Structures that do not have a unique value of their own.</p><p><strong>Aggregate Root : </strong>It is the coexistence of related entities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ymFlIGcN5z_KXkWH7uOOkA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfbd7a5e5546" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Swagger? Usage with .Net Core 3.1 Web API]]></title>
            <link>https://medium.com/@yildiraygemuk/what-is-swagger-usage-with-net-core-3-1-web-api-8832c1c8b62d?source=rss-97779c53ec24------2</link>
            <guid isPermaLink="false">https://medium.com/p/8832c1c8b62d</guid>
            <category><![CDATA[swagger]]></category>
            <category><![CDATA[net-core]]></category>
            <dc:creator><![CDATA[Yildiraygemuk]]></dc:creator>
            <pubDate>Tue, 18 Jan 2022 21:03:47 GMT</pubDate>
            <atom:updated>2022-01-18T21:03:47.431Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Swagger? Usage with .Net Core 3.1 Web API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*N000vUlKPCMGPmcY7NUqoQ.jpeg" /></figure><p>In this article, I will try to talk about what Swagger is, how it will benefit us if we use it, and how we can include it in our projects.</p><p>Swagger is a tool for developers to design, build, document, and conveniently use Restful APIs. Swagger is widely used with automated usage and test case.</p><h3><strong>Why Should We Use Swagger?</strong></h3><p>Because documentation is an important need in API development. When you want to share the services you have written with other developers or publicly, you should also share the necessary information about what your API methods do and how they work. In terms of easy readability, this is a great thing. Manually writing your API document is both a waste of time and it is close to impossible to keep it up to date. In the simplest way, hours can be spent even for every property that changes in the classes. As a solution to these problems, Swagger greatly simplifies our work.<br>Swagger provides an interface for examining, understanding and testing the Rest APIs we have written. If you want, let’s move on to how to include it in our projects with an example.</p><p>In the example we will do, we will add swagger to a project with <strong>Net Core 3.1 Web AP</strong>I.<br>We include the <strong><em>Swashbuckle.AspNetCore</em></strong> library in our project through Nuget Packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPB2fY-mRl7Y98Fy8aD4Iw.png" /></figure><p>Then we make the relevant adjustments to the <strong>Startup.cs</strong> file.<br><strong>Startup.cs / ConfigureServices :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*MhcEzY0gd8QwXbqkxgVQ1A.png" /></figure><p><strong>Startup.cs / Configure :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*MvAFfrFvoZ6_icsTP_Lzpg.png" /></figure><p>The most important point to note here is that ConfigureServices must be defined <strong>SwaggerDoc </strong>“<strong>v1</strong>” parameter and Configure <strong>SwaggerEndpoint </strong>have a name “<strong>v1</strong>”.</p><p>It can be designed that the appropriate Swagger has created for <strong>/index.html</strong> when running and running the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gYW41rwKbKq_D562U8yjlg.png" /></figure><p>We click on the Try it out button to run our <strong>API</strong>s on Swagger;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLs3-3yt5tOqNIGx8yUUuw.png" /></figure><p>By clicking the <strong>Execute </strong>button, we reach our data returned from the <strong>API</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JlsSY3TLcaW4ItA0nqF-wA.png" /></figure><p><em>In addition, you need to add </em><strong><em>[ApiExplorerSettings(IgnoreApi = true)] </em></strong><em>to the beginning of the method for methods that are unfinished during development or that you do not want to be in the document.</em></p><p>While making a request by the client, they can transfer information in different ways. One of them is done with header. If there is information that comes with a header to your methods and you want to test it on the Swagger UI, it will be enough to add the code below to your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*e_9rFZzIJFsVYxeJXgdHBw.png" /></figure><p>We need to define the above method in <strong>Startup / ConfigureServices</strong>. In the last case it will be as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*p_m05Rdq-cBgkIMjkzOs0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnzlcOgNCFZb3Ydeu1Y4Sw.png" /></figure><p>In this article, I tried to answer the questions of what is <strong>Swagger </strong>and how to include it in the project.</p><p>I hope that will be useful.<br>Hope to see you ..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8832c1c8b62d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>