<?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 Fatih Akpiyal on Medium]]></title>
        <description><![CDATA[Stories by Fatih Akpiyal on Medium]]></description>
        <link>https://medium.com/@fatih.akpiyal1?source=rss-ee5c777bab84------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8KDVj8llQAXbkqdo</url>
            <title>Stories by Fatih Akpiyal on Medium</title>
            <link>https://medium.com/@fatih.akpiyal1?source=rss-ee5c777bab84------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 04:22:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fatih.akpiyal1/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[Entity Framework Core-Table Per Hierarchy]]></title>
            <link>https://medium.com/@fatih.akpiyal1/entity-framework-core-table-per-hierarchy-c36309f6f1ce?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/c36309f6f1ce</guid>
            <category><![CDATA[entity-framework-core]]></category>
            <category><![CDATA[entity]]></category>
            <category><![CDATA[database-design]]></category>
            <category><![CDATA[inheritance]]></category>
            <category><![CDATA[database-management]]></category>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 16:58:17 GMT</pubDate>
            <atom:updated>2024-02-20T16:58:17.922Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*tEaLe6N-aDcvKvExM4DKTg.jpeg" /></figure><h3>Hello Everyone,</h3><p>Today, we’ll take a look at relational database management in Entity Framework Core from a perspective/model that differentiates and simplifies it.<br>As you can infer from the title and the image, we have a hierarchical structure in front of us.</p><p>Of course, our hierarchy won’t be like angels, humans, demons, and dwarves as depicted in the image. So, what is this concept? <br>It’s easy…</p><p>Let’s dive into the explanation!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6PP1YIej03g_abHTX5fg8w.jpeg" /></figure><h3>What is a Table Per Hierarchy(TPH)?</h3><p>In this behavior, a single table is created for all entities within the hierarchy, and when storing data in this table, common fields inherited from the base class are populated, while non-existent fields are set to nullable. In other words, a table in the database corresponds to the collective representation of multiple entities in EF Core.What does this mean? <br>Let me explain with an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*cTR8_Fcz1dpT8gHXFGw3wQ.png" /></figure><p>Here, as seen in Visual Studio, I have created three classes. Within these classes, I will explain how hierarchical entity classes work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*LCuPnRsJrN-aShs63bYJgA.jpeg" /></figure><h3><strong>Let’s imagine now.</strong></h3><p>We all more or less know how the hierarchical structure is created using the blessings of OOP (Object-Oriented Programming). If you don’t know, let me tell you briefly. <br>The notation <strong>“ChildClass: FatherClass”</strong> indicates that ChildClass inherits from FatherClass. That means the child class carries the properties of the father class. It contains them. I assume you understand whether you know it or not, and I’m proceeding with the main issue.</p><p>In a hierarchical structure, we create the desired tables by inheriting from the one above without creating separate tables for each entity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*JVh46u4hAkKeNcgyFgs5OA.png" /><figcaption>File Class(table)</figcaption></figure><p>You’re seeing a class named “File” as our main entity (table). This will serve as the primary table/entity for our other entities.<br>Here, I’ve written two data properties that could generally exist in all our entities for now. For example, FileName and Path. After this, all tables that inherit from this class will include the properties of this class.</p><p>Let’s illustrate this with an example!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*qicMY_ZPIPsUK1Q2QdqAjg.png" /></figure><p>As you can see, we’ve created another class here, which will be a table to store our invoices. It contains the same properties as FileName and Path, and we’ve even added an additional property called Price.</p><p>Now, are we going to do this every time we create a new table? <br>Of course not. Now is the time to benefit from the advantages of Object-Oriented Programming.</p><p>Note: If life gives you lemons, you should make lemonade.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*WGgCjqUoY2Hc0KIvQ8NRJw.png" /><figcaption>Invoice Table (Child One)</figcaption></figure><p>Here, you can see that with the “:” sign, we’re inheriting properties from File to our InvoiceFile class, and then we’re simply adding the specific data (column) we want for invoices. <br>And voilà! That’s it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*w7BJValZLA312FwAol3lfQ.png" /></figure><p>Let’s create an empty ProductImage entity without adding any properties for now. I’m sure this will make it easier for you to understand. This entity has a inherit from File entity as well. <br>Afterwards, I’m loading some sample data from my API and viewing it in the database. (For those who want detailed information about my API, please comment below.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*6CBQpmVN-luB0T_ULSw8AA.png" /><figcaption>Why was there another column called Discriminator? (I’ll Explain Below)</figcaption></figure><h3>As you can see,</h3><p>we were able to access the data of multiple entities through a single table. To further clarify the matter, I’ll show you how the migration is updated during migration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*Mit2I-da-lw7yWCqrkx2mg.png" /></figure><p>If you look up, it says that all properties are from the “File” table in the table part. This way, we can create a hierarchical entity structure and view our data through a single table.</p><p>I think we got this right? <br>Lets move on!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*BZ9OvMsqdHfdfeiDHZXx7Q.png" /></figure><h3>Let me explain “Discriminator” simply.</h3><p>It’s automatically generated and helps us indicate from which subclass each entry is derived within a single table.</p><p>As seen in the picture, you can understand that the data is entered into those tables based on their own properties. For example, while the InvoiceFile table contains price values, there is no price value in the ProductImage table. And automatically, null is assigned. Thats it…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*2G5z8YahsWJsJJP60mxVlA.png" /></figure><p><strong>Finally,</strong> I’m leaving you alone with my poor drawing, showing the summary of the situation in general. The ones written in red are the properties transferred from the parent class (File) to the children. The ones written in black are the properties specific to the entity added additionally to that table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*HQDhN0LGWGmM-Vgz5d8I2g.jpeg" /></figure><h3>Thank you for reading my writing!</h3><p>I explained a concept that is simple yet definitely necessary today. I hope it has been informative and enjoyable. Until the next post. <br><strong>Don’t forget to follow along!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c36309f6f1ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular Advanced Components]]></title>
            <link>https://medium.com/@fatih.akpiyal1/angular-advanced-components-33b131bae040?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/33b131bae040</guid>
            <category><![CDATA[components]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 17:34:33 GMT</pubDate>
            <atom:updated>2024-01-21T17:34:33.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QfmtMDpR23DkpSBOEB50FA.png" /></figure><h3>Hello everyone,</h3><p>Today, I will talk about two decorators in Angular that make our work easier: ViewChild and ViewChildren decorators.</p><p>ViewChild and ViewChildren decorators in Angular are special decorators used to access elements within a component.</p><p>Let’s dive into the explanation.</p><h3>ViewChild</h3><p>is a decorator that allows representing objects in the DOM within the component class. I understand that it might seem a bit tedious when discussed in theory, so let’s move on to some practical examples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*8jJ_XJDwpe4DUnThurXr0w.png" /></figure><p>I created a simple component and named it Child1Component. By default, the selector is assigned the value ‘app-child1’. This value allows us to call this component in our main component’s HTML using HTML tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rNUN04rg4oYtRzhLZ3tAww.png" /></figure><p>Then in main component(app) we are calling the component1 and import it. &lt;app-child2 #h&gt;&lt;/app-child2&gt; &lt;br&gt; like this.<br>Here, as you can see, we are marking our DOM object with the ‘h’ value. This way, we are getting closer to our main component.</p><p>What now?</p><p>Our intention was to intervene with our decorators on this marked DOM object, right? Yes, now we are moving on to do just that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o8E_9nq-y3wTwgLdd0B3SA.png" /></figure><p>With the ViewChild decorator, we can intervene in DOM objects marked with the desired value under our main component. Since it is marked with the type ElementRef, we capture the DOM object in the ‘h’ value in this way.</p><p>So far so good, right?</p><p>In the example below, you see another example, but don’t worry because it does exactly the same thing. However, this time, we are accessing this DOM object through the component. Again, in the same way, we capture this value with both child1Component and Child1Component types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXB15uGukPFOXqkMOoB3fw.png" /></figure><p>Now, if you are wondering what that ‘static’ thing means, let me explain it briefly.</p><p>static: true indicates that these DOM objects (components) with this value need to be created when the program starts running. If you&#39;re wondering what I mean, let&#39;s illustrate with an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*BuVWyLvm1UGTJbc17PSoug.jpeg" /></figure><p>Imagine a form process on an internet site. Loading the form for a user who does not intend to perform that form operation increases the cost and can provide a slower experience for the user. Therefore, for the DOM objects that need to be set up when the site opens, we return the value ‘true’ next to them. However, for a form process like in the example, it would be more logical to return the value ‘false’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*YJQKD5iJFkPaBmq6p0qqdg.jpeg" /></figure><p>Now that we’ve understood this, let’s continue…</p><p>If you’re wondering how else we can perform operations on the DOM with decorators, let me tell you about a property. In a more advanced approach, we achieve access to components through providers given within the components. This allows us to access the data specified in the provider.</p><p>It’s called read. With this property, as shown below, we can perform the necessary operations on the DOM object accessed through the component&#39;s provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*K29OqbqfjgzWqlZvxTPu-g.png" /><figcaption>Child1Component</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T9ot22PQNdbGanK4ovmJsw.png" /><figcaption>4.ViewChild is an example of read prop</figcaption></figure><h3>So we got this too! Where is the manipulation goes ??</h3><p>Once we capture them in this way, we perform the necessary operations on these objects within our component. This is typically done through two special functions: ngOnInit() and ngAfterViewInit().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*Tw6bfRT0Vva1aAwZ9-aFzA.png" /></figure><p>Here, I simply logged them to the console, but you can perform any necessary operations on these objects within your component based on your needs.</p><p>Now, I have another question for you: Why aren’t all of these in one function? What is the difference between these functions?<br>Let me explain this briefly for you. Think about it in the context of a form process:</p><p>The ngOnInit function is called when the program starts running, and it&#39;s used to invoke the initial processes that need to be done at the beginning.</p><p>On the other hand, you can think of ngAfterViewInit as a function to be called when the form is needed. Based on this, we can say that decorators marked with &#39;false&#39; cannot be invoked with the ngOnInit function.</p><h3>ViewChildren</h3><p>is used to access all elements of a specific type within a component. In other words, it is used when you want to access multiple child components within a component.</p><p>After explaining these concepts, I believe you have a good understanding of what’s going on. :D Let me provide an example to ensure you have a clear picture, and it won’t be a problem for you anymore.</p><p>Let’s assume we have three components, as I created below. All three have the same provider, but with different values. How can we handle this? Let me illustrate immediately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*j7ZwI2wLjEjCZeGdCI70BQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*n30bL7bVoiHhRRF6IgjDQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*uZ9K36_r7Nle2iEk-k-78g.png" /></figure><p>Then we have to import all of the components that we use. All of them has an same “h” tag as you can see below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B2cTgd-_7dMNjuxT326Qmg.png" /></figure><p>As you can see in the 5th example, we used @ViewChildren to capture all elements with the same ‘h’ value. Then, we read the values inside these components using the ‘read’ property and store them in the ‘_list’ variable. As shown, we captured all the values with a QueryList, specifying their data types. And that’s it! Now, you can manipulate them as much as you want. :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*9Uik5YJX9YfLoxhKMmH80A.jpeg" /></figure><p>In conclusion, we explored the powerful decorators @ViewChild and @ViewChildren in Angular, which allow us to interact with and manipulate elements within components. We delved into practical examples, understanding how to use these decorators to access DOM elements and perform operations based on specific scenarios. Additionally, we touched upon the ‘read’ property for advanced manipulation through component providers.</p><p>Thank you for reading stay tuned for more advance topics!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33b131bae040" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular -StandAlone Components]]></title>
            <link>https://medium.com/@fatih.akpiyal1/angular-standalone-components-d2f807954243?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2f807954243</guid>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Fri, 19 Jan 2024 17:38:50 GMT</pubDate>
            <atom:updated>2024-01-19T17:38:50.883Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6ucd36pXcbCjHSC1A4HTg.png" /></figure><p>Today, I will write an article about the standalone component structure introduced with Angular 15. Standalone components allow us to break free from the module structure, providing a more comfortable environment for software development. They are one of Angular’s innovations that liberate us from the complexities of module imports and exports.</p><p><strong>If y</strong>ou are wondering how to use standalone components after understanding what they are, let’s move on to that right away :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*mOBhGiKoCrNT48UMripovQ.png" /><figcaption>Simply, we create two components in the “components” directory with the following CLI commands:</figcaption></figure><p>It will create them with default structures as follows:</p><p>Afterwards, to use these components, let’s quickly write text files in their respective HTML files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*c34bRjB5ifEYdLkFfLd5kw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*4zg5noaaWrmw8d_BgZj5Ag.png" /></figure><p>Next, we navigate to our app.component.html file, which serves as the main component for our application. Here, as shown below, we use the selectors to call the desired components:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*Q2ToXFcqJgShuhysKME38Q.png" /></figure><p>Certainly, to be able to obtain output and understand that it works, we need to write the desired outputs in the standalone1.component.html and standalone2.component.html files. In this example, I&#39;ve shown it in a simple way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*y59vU9EreZJqFcO6X9QODA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*_tdOde1iyJJQgL8Qrd_cWg.png" /></figure><p>If we want standalone2 to be visible and usable in standalone1 as shown in the example, we need to make a few adjustments.</p><p>standalone2 needs to be imported into the standalone1 component. Similarly, don&#39;t forget to import the module into the standalone component to be able to use features like ngModel.</p><p>For example, in the standalone2.component.ts file, an import statement can be added like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zmYwy8mNb_6o9JEmsLNCsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*HRgSEEevgkhk2FLqacbRRg.png" /><figcaption>Sample of Output</figcaption></figure><p>Great, understood! Now, let’s provide another example with routing and lazy loading for standalone components.</p><p>Let’s go to the routes file. This file allows us to define our navigation paths and through this file, we&#39;ll perform our routing operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTqs1fPcGHWfJC2Dq57PYA.png" /></figure><p>In the first route, we have specified a path that allows us to reach the standalone component using the &quot;/standalone&quot; URL. This way, the routing process is established.</p><ul><li>path: &quot;standalone&quot;: This defines the URL path for accessing this route. In other words, we can reach this route using the &quot;/standalone&quot; address.</li><li>loadComponent: () =&gt; import(&quot;./components/standalone/standalone.component&quot;).then(s =&gt; s.StandaloneComponent): This part is used to load the component associated with the specified path. The import statement is used to achieve lazy loading. Consequently, this component is loaded only when navigating to this route, and not all components are loaded at the beginning of the application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILj-nywEGjVHdNmTn_daqg.png" /></figure><p>And then we have to use routerLink module for catching the urls that we just created right :)).<br>Also don’t forget to import that modules to app.components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*9gk-OQgvaDIgmbtbItpf9g.png" /><figcaption>standalone2 url’s Output.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*7KV0hUmUpVLgDlBfUoV5tA.png" /><figcaption>standalone url’s Output.</figcaption></figure><p>In this article, we explored the “standalone component” structure introduced with Angular 15 and discovered the conveniences that come with this structure. Standalone components integrated with routing and lazy loading enhance the performance of our application, ensuring that only the necessary components are loaded.</p><p>Continuous advancements in the Angular ecosystem bring forth new possibilities for software developers. The features introduced with Angular 15 make the application development process more efficient, ultimately leading to an improved user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*gzIM-x7DjF2Hiyw3w-RV-Q.jpeg" /></figure><p>Staying current in the ever-evolving landscape of software development is crucial, and discovering new features is essential. We hope this article has helped you gain a deeper understanding of Angular 15 and standalone components.</p><p>Happy coding! 🚀🅰️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2f807954243" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sorting and Filtering in EF Core: ToListAsync, Where, OrderBy, and Beyond]]></title>
            <link>https://medium.com/@fatih.akpiyal1/sorting-and-filtering-in-ef-core-tolistasync-where-orderby-and-beyond-9b7074ade994?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b7074ade994</guid>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Thu, 04 Jan 2024 17:38:23 GMT</pubDate>
            <atom:updated>2024-01-04T17:38:23.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yWejSMElqQeW0Asi7uy_Q.jpeg" /></figure><p>Entity Framework Core (EF Core) serves as a modern and flexible ORM tool for .NET developers. In this article, we’ll explore the data sorting and filtering capabilities of EF Core.</p><h3>ToListAsync: Asynchronous Data Retrieval</h3><p>Asynchronous programming enhances the efficiency and scalability of your application. The ToListAsync method allows you to asynchronously retrieve the results of your query as a list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*cAbYH3tiq1qglC8r0l1yEA.png" /><figcaption>example1</figcaption></figure><p>In the provided code example, using the ToListAsync() method, data is fetched from a table named Urunler on a database connection named context. This fetched data is then assigned to a variable named urunler.</p><h3>Where: Filtering</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*vdt9mSqze4l1JmCkRdL_JQ.png" /><figcaption>example2</figcaption></figure><p>In the provided code example, using the Where method, products are filtered from the Urunler table where the Id property is greater than 500. Subsequently, these filtered products are asynchronously fetched and retrieved as a list using the ToListAsync() method.</p><p>And ıf you want to use Where method IQuerable;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*D56_RlknREXAe6zMPK00YQ.png" /><figcaption>example3</figcaption></figure><h3>OrderBy</h3><p>If you wish to sort your data in descending order, OrderByDescending and ThenByDescending come into play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*7R2eVLBjih2S2gqadcO8Dw.png" /><figcaption>example4</figcaption></figure><p>“Here is an example of the OrderBy method. In this example, we are finding data where the IDs are higher than 500 and the product name ends with &#39;2&#39;. Then, we sort them using the OrderBy method based on their names.&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*YnD565Y3rLwma3pdnrgZfg.png" /><figcaption>example 5</figcaption></figure><p>“Here is an IQueryable version of the OrderBy method. You can use either approach :)). Additionally, there&#39;s another thing to note: the &#39;ascending&#39; query. This means that the data will be sorted in ascending order. If you don&#39;t specify anything, the default behavior is descending.&quot;</p><h3>ThenBy</h3><p>To sort data based on a particular property, you can use the OrderBy and ThenBy methods.</p><pre>var sortedUsers = await dbContext.Users.OrderBy(u =&gt; u.LastName).ThenBy(u =&gt; u.FirstName).ToListAsync();</pre><ul><li>OrderBy: Sorts based on the specified property initially.</li><li>ThenBy: Performs a secondary sort after the initial ordering.</li></ul><h3>Conclusion</h3><p>EF Core provides developers with a potent toolset for simplifying database operations. In this article, we&#39;ve explored a range of functionalities from asynchronous data retrieval to filtering and sorting. For further exploration of EF Core&#39;s capabilities, refer to the official documentation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b7074ade994" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simply Stack and Heap (OOP)]]></title>
            <link>https://medium.com/@fatih.akpiyal1/simply-stack-and-heap-oop-55e68515f550?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/55e68515f550</guid>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Sun, 24 Dec 2023 21:50:20 GMT</pubDate>
            <atom:updated>2023-12-24T21:50:20.344Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*89HoghjlnoNHzNSwDVdYDg.png" /></figure><h3>In this article,</h3><p>I will write an informative piece related to the fundamentals of object-oriented programming, predominantly focusing on theoretical explanations and exemplifying the concept of an “Object.” For practical demonstrations, I will use syntaxes illustrated in the C# language.</p><h4>Firstly, I’d like to start with what object-oriented programming (OOP) is and its purpose.</h4><p>Object-oriented programming is an approach that significantly shortens and systematizes software development processes. Think of it as a technique designed to facilitate software development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*L4mYeBlW96Z6lkRsWXx7Ug.jpeg" /></figure><h4>It’s a programming technique that simulates real-life objects.</h4><p>You can select any object as an example, such as a car, a chair, or a book. Through OOP, we create OBJECTS to represent these real-world entities in software. Let’s take the example of creating an object for a car. Don’t worry, we’ll just do this conceptually for now :).</p><p>Think about what attributes a car generally has. For instance, it might have a brand, a color, and a number of doors. Using the OOP approach, we can represent this car through OBJECTS with a simple syntax, as shown in C# below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*TJiDMjFIn_aAc1Z6sGCcdA.png" /></figure><h3>As you can see,</h3><p>we’ve easily created our first object. Doesn’t seem too challenging, right?</p><h4>So, what are the elements mentioned here?</h4><p>Objects contain areas where they can hold data, referred to as “Fields.” In this example, the properties like “brand,” “color,” and “doorNum” are called fields. Objects can also have functions to process the data within these fields. This is a basic representation of an object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*6qO2Dgqu1bEnI7ekYdHjnw.jpeg" /></figure><p>Now that we have a grasp on what an object is, let’s delve into some technical details. We’ll address the question, “What type are objects?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*UYQuJ7YypwLTie0RaLih3A.png" /></figure><h4>Objects are reference types.</h4><p>Variables that hold objects are also reference types. You might be thinking, “What did you just say?” Let me explain with an example.</p><p>To understand this, we need to consider the structure of RAM. For simplicity’s sake, we’ll discuss two main memory structures: the STACK and the HEAP. (Note: There’s also static memory, but we’ll keep it simple for now.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHLo2p_P7VeMWxYHRn5iog.png" /></figure><h4>Objects like “Object o” and “String s” are created in the HEAP and are referenced by variables in the STACK.</h4><p>The reason objects like “Object” and “String” use references is that they are reference types.</p><h4>So, why do we have these differences?</h4><p>Because there’s a significance to reference types. One major advantage is that with reference types, you can have multiple references pointing to a single object. If we didn’t have reference types, each variable would create a separate instance in the HEAP, leading to unnecessary memory usage.</p><h4>So, how does this benefit us?</h4><p>As programmers progress towards advanced programming, they’ll realize the importance of memory management. Therefore, understanding memory management at a foundational level and being aware of these theoretical concepts while blending theory with practice is crucial for writing efficient code.</p><h4>I hope you found this article informative and beneficial. <br>See you in my next article. Stay well!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55e68515f550" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Usage of ASP.NET Core HTTP GET, POST, PUT, DELETE Methods]]></title>
            <link>https://medium.com/@fatih.akpiyal1/usage-of-asp-net-core-http-get-post-put-delete-methods-b9e0e08f726e?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9e0e08f726e</guid>
            <category><![CDATA[webapi]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Mon, 26 Jun 2023 18:08:04 GMT</pubDate>
            <atom:updated>2023-06-26T18:08:04.282Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*kshLwW_nsQCJVVV4sHGnpw.png" /></figure><h3>Starts the Kestrel Web Server.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*7hWKbtKFTY_xUNxR5QFmwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z61uTdvIh6VclbAPgkWhKw.png" /></figure><h3>The Startup</h3><p>class allows us to configure various aspects of our application. Generally, we make the necessary changes in this class.</p><p>In the ConfigureServices method, we add the services we require.</p><p>Inside the Configure method, we set up the HTTP pipelines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*34AMCCNn32M9-jhI5WiqJg.png" /></figure><p>This way, we can perform routing by creating routes based on the entered URL path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*tOvWyBdjB8ouYQBwZwdAZg.png" /></figure><p>We make the following changes in the Startup class to enable routing from different classes:</p><p>To add controllers, we use the services.AddControllers() method.</p><p>After the app.UseRouting() method, we add a new method called app.UseEndpoints, which shapes the endpoints based on the controllers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*Q1HbfsL1cbVX9YtqcLXRoA.png" /></figure><p><strong>In Visual Studio, we create a class named “ProductsController”. This class inherits from the “ControllerBase” class, which is a part of the system.</strong></p><p>If the URL ends with “/products”, it enters this class, and if it then encounters “/products/merhaba”, it returns “merhaba”.</p><h3>Http Get, Post, Put, Delete Methods</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*3kRs085JXm8w8asHqcw8xw.png" /></figure><p>We have created a new project. We created a folder called “Controllers” and inside that folder, we created a class named “UsersController”. This class also inherits from the “ControllerBase” class.</p><p>We performed the routing in the following way. In API operations, routes typically start with “api” (“api[controller]”). The “controller” part will be replaced with the name of the controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*y2p07DBGnm7p3dmAmHSH1A.png" /></figure><p>Then, we created a file named “Models” and inside that, we created a class called “User”. We placed its properties inside the class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*LBXOUgLf2olQnFt7_OzdrQ.png" /></figure><p>Then, we will create some fake data. We will accomplish this using a library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*zQC1fURdFldtOuGe3yTZlg.png" /></figure><p>Great! You added a file called “Fake” and created a class named “FakeData” inside it.</p><p>We right-click on the project and navigate to the “Browse” section using this shortcut. Then, we download the library named “Bogus”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*oIMLD_6v-UmL3xdb3uIAyw.png" /></figure><p>Inside the class, we created a field named “_users” of type List. We also wrote a method called “GetUsers”.</p><p>To prevent the _users from being modified each time, we have implemented a conditional statement. Additionally, we have created new users using the RuleFor method from the Bogus library. By prefixing with f., we can access the methods available within Bogus. We then use the .Generate(number) method to generate the users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*tRKg4GTlcO3iPElcd2KUaw.png" /></figure><p>The controller is modified as follows. Then, we customize this controller. In the second GET operation, we can see that it presents the data specified by the ID. We defined an additional GET method to achieve this. Now, with the HttpGet(“{id}”) route, when the program is running, it will provide us with the data corresponding to the number you added at the end of the URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*6nexlSh1KfKhGiJKJ8OLhg.png" /></figure><p>The line “var editUser = _users.FirstOrDefault(x =&gt; x.Id == user.Id);” can be explained as follows:</p><p>It is a LINQ query used to find the relevant user in the collection of users (_users) stored in the table based on a specific user’s (user) Id.</p><p>In the given code snippet, it iterates over the users in the _users collection and checks the condition x.Id == user.Id for each user. The FirstOrDefault method finds the first element in the collection that satisfies the condition or returns the default value if no element satisfies the condition.</p><p>This code snippet can be used to find a specific user in the _users collection using their Id. If there is a user that satisfies the condition, the editUser variable represents that user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*niVYoiCPPyHNpXNFIWoUAQ.png" /></figure><p>In the POST section, we can interpret the function’s parameter as follows: “I expect a user object from the request’s body. Please send it to me so that I can add it to the list.”</p><p>Similarly, in the PUT and DELETE sections, we can consider the same concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*McX5Na6-_riUY_T0bnQ01A.png" /></figure><p>After running the program, we can copy the URL provided locally and use the Postman application to perform the necessary HTTP operations for testing purposes.</p><p>Translation:</p><p>After running the program, we can copy the URL provided locally and use the Postman application to test the required HTTP operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFp5MZYgRrFatXQ9QqW_3Q.png" /></figure><p>We open a new Collection by clicking on the “+” sign in the upper left corner. We enter the URL path that we specified for the operation, and then we click on the Get icon located on the left side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*vf-BUPXr8BD4TSabzqAOIA.png" /></figure><p>You can apply and test any type of HTTP protocol you want here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9e0e08f726e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ASP.NET Core Web API: Your Path to Building Powerful APIs]]></title>
            <link>https://medium.com/@fatih.akpiyal1/asp-net-core-web-api-your-path-to-building-powerful-apis-a5338ef3b81d?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5338ef3b81d</guid>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[web-api-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Sat, 24 Jun 2023 12:33:39 GMT</pubDate>
            <atom:updated>2023-06-24T12:33:39.748Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*Mi8sOJTlJSE-N8plGvjBnQ.png" /></figure><h3>HTTP:</h3><p>HTTP stands for Hypertext Transfer Protocol. It is a communication protocol used for transferring data between computers over the internet. HTTP follows a client-server model, where a client (typically a web browser) sends a request to a server, and the server processes the request and sends back a response.</p><h3>REST and RESTful services:</h3><p>REST (Representational State Transfer) is an architectural style used to create APIs for data manipulation over HTTP. It encompasses the representation of resources in a network (such as database resources or files) and the operations that allow access to these resources.</p><h3>Http Request Methods:</h3><p>There is a bunch of Http method usually used to describe how endpoints or APIs can expect data from clients which integrate with them, these http methods include, but not limited to: <br> <br> — **POST**:</p><p>It is used to create or submit a resource at a URI. For example, the POST method is used to submit a form to the server.</p><p>**GET**: It is used to retrieve a resource (e.g., a web page) at a specified URI. The GET request returns the representation of the resource from the server. This method should only be used for reading resources and should have no side effects.</p><p>**PUT**: The PUT request is used to completely update a resource at a specific URI or create a resource at the specified URI. The data in the request body replaces the entire resource or creates a new resource at the specified URI.<br> URL:/books/123<br> <br> — Data: <br> { “title”: “Yeni Kitap Başlığı”, “author”: “Yeni Yazar”, “year”: 2023 }<br> PUT /books/123 <br> HTTP/1.1 Host: example.com Content-Type: application/json <br> Content-Length: 72</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*Fg7S68ZCLluNFdyH-KRz3A.png" /></figure><p>- — **DELETE**: <br> — It is used to delete a resource at a specified URI. If the server successfully deletes the resource, it can return a response such as 200 OK or 204 No Content.</p><h3>Content-Type :</h3><p>It is one of the HTTP header fields and is used to specify the type of data being carried in an HTTP request or response. The Content-Type header indicates the media type (MIME type) of the transmitted data and, if necessary, the character set.</p><p>The Content-Type header is typically included in the HTTP request or response headers in the following format:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*2p6d7RiDsKp2LCRjaFkMig.png" /></figure><p>For example, if data is being transported in JSON format, the Content-Type header can be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*Vh68kjrNxmdz9srSZg-qhw.png" /></figure><p>This header specifies to the server or client that the transmitted data is in JSON format and the character set is UTF-8.</p><p>- application/json: JSON<br>- application/xml: XML <br>- text/plain: Plain text<br>- text/html: HTML <br>- image/jpeg: JPEG <br>- image/png: PNG <br>- application/pdf: PDF</p><p>The Content-Type header ensures the transmission of data in the correct format during data exchange between the client and server. It also plays a vital role in ensuring that the response received by the client is processed correctly.</p><h3>Request Headers:</h3><p>HTTP headers facilitate the transfer of metadata during the transmission of HTTP requests and responses. Request headers are used to specify the characteristics of the request, client preferences, and request attributes. Response headers, on the other hand, contain information about the server’s response. HTTP headers allow for a more detailed specification of the information transmitted via HTTP requests and responses.</p><h3>HTTP Statuses:</h3><p>HTTP Statuses represent the status of a RESTful service after an HTTP Request has been initiated and completed by the client.</p><p>The statuses are standardized numerical values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*C-fLh5BpKbo-64LkCFDb-g.png" /></figure><h3>Learn about JSON:</h3><p>JSON is a text-based format used for manipulating and storing data. It has a simple and easy-to-understand structure that can be interpreted and parsed by both humans and machines. The JSON format is represented as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*MaQjk5i32or-fACSIwmG0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*MaQjk5i32or-fACSIwmG0Q.png" /></figure><p>Newtonsoft.Json** :<br> This library facilitates the process of converting JSON data to .NET objects (serialization) and .NET objects to JSON data (deserialization).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*FvhI2vN2c_dsWpEw7bGliA.png" /></figure><p>**System.Text.Json** :<br>System.Text.Json is the official JSON processing library provided by .NET and is built-in starting from .NET Core 3.0 and later versions.</p><h3>HTTPS:</h3><p>HTTPS is the secure version of http. when a user tries to open a website that data is transmitted through SSL Secure Socket Layer, a website must have a valid SSL certificate applied for the website and installed on the hosting sever for the website to be accessible via the https protocol.</p><p>All modern browsers now show a lock icon beside the site that is accessible over https and has a valid SSL certificate.<br> If you are building an API that accepts personal information or sensitive data like credit cards, you must support only https and not allow plain http calls.</p><h3>Features and Components to Learn ASP.NET Core Web API:</h3><p>Controllers and Routing are components in ASP.NET Core Web API that define the HTTP methods and route URLs (endpoints). Controllers determine the HTTP methods and route URLs that will be exposed to clients.</p><h3>API Versioning:</h3><p>You can define multiple versions of the same APIs or endpoints by introducing the versioning prefix, where you add a specific prefix as part of the API url to define which version it is, so usually it looks like this:</p><p><a href="https://codingsonata.com/api/v1/posts">https://codingsonata.com/api/v1/posts</a></p><p>See here, the v1 indicates that we are requesting the posts API under version 1 of your API, you can create v2 and have a different implementation in it, which might also include any change that might break the v1 of your implementation.</p><p>The ApiVersion attribute can be used to specify which version your endpoint or method is currently only.</p><h3>Middleware:</h3><p>Middleware is a software class or component in an ASP.NET Core application that can be injected at various points in the processing steps or “pipeline”. It is used to handle or process requests and responses.</p><p>In ASP.NET Core framework, there are predefined middlewares available, such as UseAuthentication() and UseAuthorization(). These middlewares perform operations like authentication and authorization.</p><p>Additionally, you can use middlewares provided by providers via NuGet. For example, middlewares like UseSwagger() or UseSwaggerUI() found in the Swashbuckle.AspNetCore package.</p><h3>Attributes:</h3><p>Attributes are decorations that can be applied to classes and methods in order to filter data before or after the request is processed. Attributes can be used to enable various features of ASP.NET Core. For example, attributes like [HttpGet], [HttpPost], [HttpPut], and [HttpDelete] can bind a method to a specific HTTP request type and enable request routing.</p><h3>Filters:</h3><p>Filters are components used in ASP.NET Core to process and modify requests and responses. Filters work at a specific point in the ASP.NET Core pipeline to handle the request or modify the response. Filters allow you to have more flexible control over how requests are processed and responses are manipulated in your ASP.NET Core application. They can be used in different scenarios such as customized operations, authorization checks, error handling, and resource management.</p><h3>Program.cs:</h3><p>The Program.cs file serves as the entry point of your application and is where your application starts before ASP.NET Core. In this file, you perform the initial setup and configuration of services for your entire Web API project.</p><p>In the Program.cs class, you define a WebApplication instance using the WebApplication.CreateBuilder(args) method. With this instance, you can read the Services Collection, Configuration, and other important components. After adding all the necessary service details, you create the WebApplication and configure different middleware that will be used in your pipeline.</p><p>Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*iq0JNpTyl0m-aCwZAii2Wg.png" /></figure><p>In the given example, the Main() method is responsible for initiating the application by invoking the CreateHostBuilder(args).Build().Run() code. The CreateHostBuilder(args) method creates an instance of IHostBuilder and allows you to perform configuration. The ConfigureWebHostDefaults() method sets up the default configuration for a web application and configures the hosting using the Startup class.</p><h3>Appsettings.json:</h3><p>This is a JSON formatted file that includes all the settings and configurations that you can use in ASP.NET Core Web API.</p><p>This file resides in the server and is mainly useful to control settings on production environment without having to rebuild your code and republish it all over again.</p><p>Below is a sample appsettings.json file, that include different settings such as ConnectionStrings, AppSettings, Logging. You can add whatever settings you need for your APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*hOssmd4zCE7YvuDdr8u8JQ.png" /></figure><p>In the given example, under “ConnectionStrings,” the database connection string is set. Under “AppSettings,” you can configure the title of your API, its version, and whether logging should be enabled or not. Under “Logging,” you can specify the log levels to be recorded. The appsettings.json file allows you to manage your application settings in one place, providing convenience for modifying configurations or switching between different environments.</p><h3>Dependency Injection:</h3><p>You should first understand the dependency injection as a design pattern or a programming concept, before learning how it is used in ASP.NET Core.</p><p>Dependency Injection is basically providing an object that is needed by another object, so if a class A depends on class B, then we don’t let class A care about creating an instance of class B itself but inject an instance of class B into A.</p><p>This is mainly useful for testing, and for loosely-coupling the dependencies.</p><p>[Check this StackOverflow thread](<a href="https://stackoverflow.com/questions/130794/what-is-dependency-injection">https://stackoverflow.com/questions/130794/what-is-dependency-injection</a>) to better understand this topic.</p><p>Once you get a basic understanding of how and why dependency injection is used, then you can head right away to learn more about [dependency injection in ASP.NET Core](<a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0</a>).</p><p>In ASP.NET Core Web API, the dependency injection is a fundamental design pattern used at the core of any Web API project when defining object creation.</p><p>There are 3 levels of object creation and lifetime as part of the dependency injection in ASP.NET Core Web API:</p><p>- **Singleton**</p><p>Instance of object would be shared across all the different requests.<br> <br> — **Scoped**</p><p>Instance would be shared for the same requests</p><p>- **Transient**</p><p>New object would be created for each request</p><p>You can follow this [StackOverflow thread](<a href="https://stackoverflow.com/questions/38138100/addtransient-addscoped-and-addsingleton-services-differences">https://stackoverflow.com/questions/38138100/addtransient-addscoped-and-addsingleton-services-differences</a>) that is discussing these 3 different object creation strategies through the dependency injection in ASP.NET Core Web API.</p><h3>API Security:</h3><p>API Security is a huge and sometimes complicated topic that has different use cases and implementations, but it is an essential and critical part in your journey to learn ASP.NET Core Web API.</p><p>So, you must give this topic a plenty of time and dedication from yourself to properly understand all the concepts and implement the best practices to build secure and reliable Web APIs.</p><h3>Authentication and Authorization:</h3><p>Before we dive deeper into this topic, first thing you need to learn is the difference between Authentication and Authorization</p><p>- **Authentication**: is the process of verifying that a user has the rights to access your APIs. Usually an unauthenticated user trying to access your APIs will receive an http **401 Unauthorized** Response</p><ul><li>**Authorization** is the process of verifying if the authenticated user has the proper rights or permissions to access a specific API. Usually an unauthorized user trying to access your API that is only valid for a specific role or requirement will receive an http **403 Forbidden** Response<br>- <br>-</li></ul><h3>ASP.NET Core Identity :</h3><ul><li>The Identity is a framework that introduces membership functionality for the API users, with methods for login, logout, register along with passwords and claims management, and also it define roles and permissions for users. Also it provides UI pages for the membership functionality.</li></ul><p>[The official docs will help you learn more about ASP.NET Core Identity](<a href="https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-5.0&amp;tabs=visual-studio">https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-5.0&amp;tabs=visual-studio</a>)</p><h3>Basic Authentication:</h3><p>The basic authentication method is a way to transmit data to the API in a base64-encoded format where the header name is Authorization and the value is ‘Basic’ follow by a space then followed by base64encode(username:password), or base64encode(clientid:secret)<br> <br> Below is a sample of how a basic authentication request header can look like:</p><p>_Authorization: Basic YmFzZTY0OmVuY29kZQ==_</p><p>This can be used to authenticate applications, but it is not the preferred way since the client has to pass this header each time doing an authenticated request and if the conenction is not over http then the credentials are plainly visible by anyone who spoofs the network.</p><p>Usually, this authentication is coupled with JWT Bearer authentication or OAuth 2.0 to securely authenticate and authorize clients in a standard way.</p><h3>API key Authentication:</h3><p>This is another authentication mechanism mainly used to identify and authorize your API clients (not users), API Key can be passed either via query string, request body, Basic Authentication header or a custom header such as x-api-key</p><p>The API will then look for the api key in any of the locations mentioned above and validate it and then authorize the client to access the api.</p><p>Check the following tutorial to help you learn how to implement the API Key Authentication in your API Project [Secure ASP.NET Core Web API using API Key Authentication](<a href="https://codingsonata.com/secure-asp-net-core-web-api-using-api-key-authentication/">https://codingsonata.com/secure-asp-net-core-web-api-using-api-key-authentication/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*00e8mxkM98KhGM_34CSZJg.png" /></figure><h3>JWT (Json Web Token ) Authentication:</h3><p>JSON Web Token is a way to format your bearer tokens in a standard and simple way, it includes 3 parts: header, payload and signature.</p><p>You can build a solid API Authentication with JWT and it is very easily done in ASP.NET Core.</p><p>Check this article [Secure ASP.NET Core Web API using JWT Authentication](<a href="https://codingsonata.com/secure-asp-net-core-web-api-using-jwt-authentication/">https://codingsonata.com/secure-asp-net-core-web-api-using-jwt-authentication/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*ZPGCH5EpZ_MWD1UPHqsXpw.png" /></figure><p>In many cases, you will need to implement refresh token alongside an access token, so that you can use your refresh token to renew or refresh your access token, and usually you will want to do this silently, some time ahead of the actual expiry time of your refresh token, so your logged in users won’t notice the refreshing part and won’t be logged out of their accounts.</p><h3>JWT Access Tokens and Refresh Tokens:</h3><p>This is a comprehensive tutorial that explains how to **[Apply JWT Access Tokens and Refresh Tokens in ASP.NET Core Web API 6](<a href="https://codingsonata.com/apply-jwt-access-tokens-and-refresh-tokens-in-asp-net-core-web-api-6/)**">https://codingsonata.com/apply-jwt-access-tokens-and-refresh-tokens-in-asp-net-core-web-api-6/)**</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*9h5h91LWvQGT92SFcRq1Pw.png" /></figure><h3>OAuth 2.0 and Open Id Connect:</h3><p>OAuth 2.0 is the authentication and authorization standard framework that can guarantee the proper access to the users to your APIs through the different platforms.</p><p>You can easily configure ASP.NET Core Web API to implement the OAuth 2.0 framework via identity providers, such as [Auth0](<a href="https://auth0.com/docs/quickstart/backend/aspnet-core-webapi#configure-auth0-apis">https://auth0.com/docs/quickstart/backend/aspnet-core-webapi#configure-auth0-apis</a>), Identity Server 4 (which is now part of [DuendeSoftware](<a href="https://duendesoftware.com/products/identityserver">https://duendesoftware.com/products/identityserver</a>)).</p><p>You can also enable your users to sign in from their existing credentials on social or external providers</p><p>[Check this tutorial about Facebook, Google, and external provider authentication in ASP.NET Core](<a href="https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/?view=aspnetcore-6.0&amp;tabs=visual-studio">https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/?view=aspnetcore-6.0&amp;tabs=visual-studio</a>)</p><h3>Fine-graining Authorization using Policies, Roles and requirements:</h3><p>Usually you will have different roles assigned for your users, for example if you have a blog management system and you have different categories of users who can access and use your system, then you will probably won’t allow a guest blogger to delete articles submitted by you or a regular user who subscribes to your blog to edit or delete content from an article. So everything must be protected by roles.</p><p>Visit the official Microsoft documentation to learn more about [Policy Based Authentication in ASP.NET Core Web API](https://learn.microsoft.com/en-us/aspnet/core/security/authorization/policies?view=aspnetcore-6.0).</p><p>You can also check this tutorial [Secure ASP.NET Core Web API using JWT Authentication](<a href="https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/?view=aspnetcore-6.0&amp;tabs=visual-studio">https://codingsonata.com/secure-asp-net-core-web-api-using-jwt-authentication/</a>) where in it I explain how to apply JWT Authentication and authorization with a policy and requirement.</p><h3>API Documentation with Swashbuckle and Swagger:</h3><p>Now in ASP.NET Core Web API 6, OpenAPI V3 is enabled by default once you start a new project with the API template,</p><p>Once you create the new ASP.NET Core Web API 6 template project, you can run it and you will start noticing a nice Swagger UI view instead of the regular random JSON result you get on the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*L0_9OO_mylujwtSv_2CTzA.png" /></figure><p>This is done through Swashbuckle ASP.NET Core Library.</p><p>[You can read more about Swashbukle here](<a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle">https://docs.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-swashbuckle</a>) and [how to build help pages using swagger](<a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger">https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger</a>)</p><p>Also it is always important to understand the core or fundamentals of any feature, check the following link to learn more about [The OpenAPI Specification V3](<a href="https://swagger.io/specification/">https://swagger.io/specification/</a>)</p><h3>DTO Data Transfer Objects:</h3><p>DTOs are plain objects (POCOs) that simply serve as the middle layer between your data layer and your client.</p><p>It is important that you separate the data layer with your API layer, so that you don’t expose the full object details to your clients and have the control on what to display and what to receive from them.</p><p>A great transformation tool that comes really handy whenever you have too many database entities and you want to convert them to and from their counterpart DTOs, is the [AutoMapper](<a href="https://automapper.org/">https://automapper.org/</a>).</p><p>With AutoMapper you can define configurations for how to map between your Database entities and DTO classes, and then AutoMapper will handle the rest. And if you are following conventions in naming your DTOs then the mapping will be done without even defining configurations</p><p>In ASP.NET Core, it is very easy to integrate with AutoMapper.</p><p>Just install the AutoMapper and AutoMapper dependecy Injection extenions NuGet Packages</p><p>Create a class that inherits from AutoMapper’s Profile, your class’s constructor will define the mappings between your entities and DTOs</p><p>And in Startup class, in configureServices method, configure the AutoMapper with the new class and then append the configurations to the Services Collection Object</p><p>In your controller’s constructor, inject the AutoMapper object through the IMapper Interface,</p><p>Then use the Map method from the injected mapper object to convert between your entity and DTO model.</p><p>[This SO Answer](<a href="https://stackoverflow.com/a/40275196/2797154">https://stackoverflow.com/a/40275196/2797154</a>) has a detailed instructions for how to use AutoMapper in ASP.NET Core.</p><h3>Error Handling and Logging:</h3><p>A middleware is the best way to catch all your exceptions, format them and log them. A bad practice is to put a try catch block on each API method.</p><p>This 2 tutorials are to explain how to implement error handling and logging, see the below:</p><p>[Logging with Serilog in ASP.NET Core Web API](<a href="https://codingsonata.com/logging-with-serilog-in-asp-net-core-web-api/">https://codingsonata.com/logging-with-serilog-in-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*R4bgx1ACp2qi4PzknM0SVw.png" /></figure><p>[Exception Handling and Logging in ASP.NET Core Web API](<a href="https://codingsonata.com/exception-handling-and-logging-in-asp-net-core-web-api/">https://codingsonata.com/exception-handling-and-logging-in-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*k0lUHvEG3w41xT3xU6bmWQ.png" /></figure><p>Check this tutorial to learn how to [Handle errors in ASP.NET Core Web APIs](<a href="https://docs.microsoft.com/en-us/aspnet/core/web-api/handle-errors?view=aspnetcore-6.0">https://docs.microsoft.com/en-us/aspnet/core/web-api/handle-errors?view=aspnetcore-6.0</a>)</p><p>And check this post to understand how to implement [Logging in .NET Core and ASP.NET Core](<a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-6.0">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-6.0</a>)</p><p>Error Handling:</p><ol><li>For error handling, it is best to use a middleware in ASP.NET Core. Middleware is a component that intervenes during request processing or response generation and performs specific operations.</li></ol><p>Logging:</p><p>Logging is the process of recording events that occur during the execution of an application. In ASP.NET Core, a commonly used logging library is Serilog.</p><p>With Serilog, you can configure logging and store errors or other events in log files or other destinations.<br> <br> To add Serilog to your project, you can follow these steps:</p><p>- Add Serilog and Serilog.AspNetCore as NuGet packages to your project.<br> — Configure Serilog in the ConfigureServices method within your Startup.cs file.<br> — Enable Serilog logging by using the `app.UseSerilogRequestLogging()` method in the Configure method.</p><p>By following these steps, you can capture, format, and appropriately log your errors.</p><h3>Unifying Error Responses:</h3><p>You should always to try to have a unified structure of error responses to your clients, so that they can identity the error you are trying to transmit.</p><p>Once way for this, is that you can create a model that will have a code and description. And then whenever you want to return a 400 BadRequest Response, then you can put your response in an error model object with code and description, so the front-end app or client, once receives the error response, it can easily pick the code and display the proper message for the user ( usually there might be multiple localizations for each code to support multiple languages).</p><p>1. Define an error model class with properties for code and description. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*C1arKtXY9ORJXdpyrPVIaw.png" /></figure><p>2. When encountering an error, create an instance of the error model and populate it with the appropriate code and description. For instance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*oS5Ahlzbe7rYAK5eOTXR6g.png" /></figure><p>3. Return the error model as part of the response, typically as a JSON object. This allows the client to access the code and description properties. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*kSM6pLIQ4pzqjG5aZtuhWw.png" /></figure><h3>Request Validation:</h3><p>Request validation refers to the process of checking and ensuring that the data sent in a request is valid and meets the required criteria before processing it. It is an essential step to maintain data integrity, security, and alignment with business rules.<br> In the context of ASP.NET Core Web APIs, there are various approaches to implementing request validation:<br> Model-Level Validation:</p><p>- By using data annotations or implementing the `IValidatableObject` interface, you can define validation rules directly on your model classes.<br> — Data annotations provide attributes such as `[Required]`, `[MaxLength]`, `[Range]`, etc., to specify constraints on the properties of your model classes.</p><h3>Fluent Validation:</h3><p>By using Fluent Validation, you can perform request validation, ensuring the security and data integrity of your application. You can define validation rules in a simple and intuitive way, accommodating complex scenarios effectively.<br> 1- Easy and simple API: Fluent Validation provides a straightforward and readable API for defining validation rules. By chaining the rules, you can easily handle complex validation scenarios.<br> 2- Predefined validation rules: Fluent Validation offers a set of predefined validation rules to facilitate common validation scenarios. You can use these rules to easily validate data types, length constraints, ranges, presence checks, and more.<br> 3- Custom validation rules: Fluent Validation allows you to define your own custom validation rules. You can create custom validation rules that meet your specific needs and integrate them into your project.</p><h3>Localization:</h3><p>When building APIs, sometimes you might need to make it support multiple languages/cultures, in this case you have to prepare your APIs to be localized to a specific language and culture.</p><p>In ASP.NET Core Web API it is easy and straightforward to localize the resources in your APIs and make it culture aware of your user input from the client app.</p><p>[Follow this documentation tutorial to learn more about localizing your APIs](<a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-5.0">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-5.0</a>)</p><p>And check this tutorial to learn how to implement localization in ASP.NET Core Web API</p><p>[Localization in ASP.NET Core Web API](<a href="https://codingsonata.com/localization-in-asp-net-core-web-api/">https://codingsonata.com/localization-in-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*3Uv5tX2nFNWu_VWpReTLPg.png" /></figure><h3>Entity Framework Core:</h3><p>EF Core is the successor of Entity Framework library used in .NET Framework. It is an ORM-based framework that would help you integrate with a given relational database in a simple and effective way.</p><p>EF or EF Core support LinQ, change tracking, lazy loading, migrations and more.</p><p>You can simply integrate your ASP.NET Core Web API Project with EF Core, and now EF Core is even better with the latest update EF Core 6.</p><p>To learn more about how to connect your API Project with SQL Server Express DB and Entity Framework Core check this article [Build RESTful APIs Using ASP.NET Core and Entity Framework Core](<a href="https://codingsonata.com/build-restful-apis-using-asp-net-core-and-entity-framework-core/">https://codingsonata.com/build-restful-apis-using-asp-net-core-and-entity-framework-core/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*ExUC0Qak3ClbWq64Xtiusg.png" /></figure><h3>Hosting and Deployment:</h3><p>Throughout your journey to learn ASP.NET Core Web API, you will need to understand how to deploy your ASP.NET Core Web API so that they can run on either localhost, On-prem server, docker or any of the cloud-based services.</p><h3>Kestrel or IIS Express (Localhost):</h3><p>This is the first hosting environment you get once you start a new project. Visual studio automatically assigns a random ports, for both http and https, on your local machine’s IIS Express and from there you can start building your APIs and testing them.</p><p>**launchSettings.json** is the file that contains settings that are only related to development and debugging profiles. so it is used only on the development machine and not on the production environment.</p><p>In .NET 6, the default hosting provider that comes with ASP.NET Core is the Kestrel web Server, you can read more about [Kestrel Web Server here](<a href="https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-6.0">https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-6.0</a>).</p><p>You can setup multiple profiles for launching url on Kestrel, IIS Express or other local hosting environments.</p><h3>IIS (On-prem):</h3><p>If you are willing to host your ASP.NET Core Web API on a Windows Server with IIS, check out this detailed tutorial about how to [Deploy ASP.NET Core Web Api on IIS](<a href="https://codingsonata.com/deploy-asp-net-core-web-api-on-iis/">https://codingsonata.com/deploy-asp-net-core-web-api-on-iis/</a>) , it is has been updated to .NET 6, but if you are using an older version, the steps should be the same with the difference of the hosting bundle version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*xGXUxiJYnfoLL-36SIIwEg.png" /></figure><h3>Deploy to Docker:</h3><p>Docker is amazing platform that provides you the right tools to place all your ASP.NET Core Web API Project along with all its related SDKs and hosting bundle into a container and test your project somewhere else, on a different OS, machine.</p><p>[You can start from this tutorial](<a href="https://microsoft.github.io/AzureTipsAndTricks/blog/tip54.html">https://microsoft.github.io/AzureTipsAndTricks/blog/tip54.html</a>)</p><p>Also read this documentation about how to [Dockerize an ASP.NET Core Application](<a href="https://docs.docker.com/engine/examples/dotnetcore/">https://docs.docker.com/engine/examples/dotnetcore/</a>)</p><h3>Deploy to Azure:</h3><p>With Azure you can easily take your ASP.NET Core Web APIs to the cloud plus Visual Studio has built-in support for publishing to Azure, so the process is quite simple.</p><p>You have multiple options when it comes to deploying your Web APIs to Azure, and the choice would usually depend on the usage and the budget.</p><p>- [Azure App Service](<a href="https://docs.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?pivots=platform-windows">https://docs.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?pivots=platform-windows</a>)<br>- [Azure Container Service](<a href="https://azure.microsoft.com/en-us/products/category/containers/">https://azure.microsoft.com/en-us/products/category/containers/</a>)</p><p>And if you want to have an API gateway that stands in front of your API as a reverse-proxy or facade, then you should start looking into [Azure API Management](<a href="https://azure.microsoft.com/en-us/products/api-management/">https://azure.microsoft.com/en-us/products/api-management/</a>)</p><h3>Deploy to AWS:</h3><p>Another cloud provider for your ASP.NET Core Web API project is the AWS.</p><p>Same as in Azure, based on the expected usage of your APIs and your assigned budget you can choose between different services provided by Amazon to publish your APIs:</p><p>- [Elastic Container Service (AWS ECS)](<a href="https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/deployment-ecs-aspnetcore-ec2.html">https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/deployment-ecs-aspnetcore-ec2.html</a>)<br>- [Elastic Beanstalk](<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html">https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html</a>)<br>- [Lambda and API Gateway](<a href="https://aws.amazon.com/blogs/developer/deploy-an-existing-asp-net-core-web-api-to-aws-lambda/">https://aws.amazon.com/blogs/developer/deploy-an-existing-asp-net-core-web-api-to-aws-lambda/</a>)</p><p>Also you can equip Visual Studio with support to publish over multiple AWS services using the AWS extension. You can download it from within Visual Studio. Tools -&gt; Extensions</p><h3>API Unit Tests:</h3><p>API unit tests are tests that are used to verify that the controllers, services, and other components in your API project are functioning correctly. Unit tests are typically small, isolated tests that are written to validate the proper functioning of API functionality. These tests are used to detect potential errors and unexpected behaviors.<br> You can create a new test project within the same solution that includes the API project. The test project can be of type NUnit Test or XUnit tests.</p><p>With a few differences in the structure of both tests, both would give you the ability to writing unit tests for your APIs to test that the controllers, the services, and anything is functioning normally.</p><p>You can go through [this StackOverflow thread](<a href="https://stackoverflow.com/questions/9769047/nunit-vs-xunit">https://stackoverflow.com/questions/9769047/nunit-vs-xunit</a>) to learn more about the difference between NUnit and XUnit Tests</p><p>Always remember to keep your tests to the minimal and to follow the Arrange, Act, Assert order to properly build your tests.</p><p>You can also build integration tests using the unit testing framework in ASP.NET Core. Integration tests are similar to unit tests but involve a larger scale of testing where your actual database and network connection and integration are also tested. With unit tests, you usually don’t run the actual database or network call but provide a mock or fake classes, using dependency injection, that can supply your test with the needed data to run your test.</p><p>Check the following learning material from Microsoft to learn more about integration tests in [ASP.NET Core](<a href="https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0">https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-6.0</a>).</p><p>You can also go with the test-driven development methodology (TDD) which states that we should write the test before writing the actual code or implementation, so this implies that you should start converting the functionality requirements or user stories to test cases, make them fail and then write the actual functionality to make the tests pass.</p><p>[Check this article to read more about TDD](<a href="https://www.agilealliance.org/glossary/tdd/">https://www.agilealliance.org/glossary/tdd/</a>)</p><h3>Postman for Testing and Simulation:</h3><p>Postman is the ultimate tool to test your ASP.NET Core API endpoints, it has everything you need and more to simulate a client to call your APIs, you can create collections, teams, workspaces, environment variables.</p><p>You can [download Postman here](<a href="https://www.postman.com/downloads/">https://www.postman.com/downloads/</a>)</p><p>Also check this [comprehensive tutorial about how to use Postman for testing](<a href="https://www.guru99.com/postman-tutorial.html">https://www.guru99.com/postman-tutorial.html</a>)</p><p>Most of this tutorials include testing part using Postman, let me share with you one of these tutorials not mentioned above that has different requests using Postman</p><p>[File Upload with Data using ASP.NET Core Web API](<a href="https://codingsonata.com/file-upload-with-data-using-asp-net-core-web-api/">https://codingsonata.com/file-upload-with-data-using-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*T3AgJrzYlxlxbbK4erWrLg.png" /></figure><h3>Integration with Front-end frameworks (Web and Mobile):</h3><h4>ASP.NET Core Web API Integration with Angular:</h4><p>Before that, let me basically explain what is “Angular”. <br> Angular is a web application development platform. It was initially developed by Google and has become an open-source project. Angular is a JavaScript framework used for building dynamic, single-page applications (SPAs).<br> Angular provides developers with a range of tools and components to build large-scale and complex applications. It is based on a component-based architecture and offers features such as user interface, data management, routing, error handling, form handling, data binding, and more.</p><h4>**Let me explain the basic steps of this tutorial:</h4><p>1. Create an Angular project: Use the Angular CLI to create a new Angular project.<br> <br> 2. Create an API service: Create an API service to connect Angular with your ASP.NET Core Web API. This service will include HTTP methods (GET, POST, PUT, DELETE) to make requests to the API.<br> <br> 3. JWT authentication: Use JWT (JSON Web Token) authentication in your ASP.NET Core Web API. This provides a security mechanism to control access to your API by verifying the identity of users.<br> <br> 4. User registration and login: Create the necessary components and services in Angular for user registration and login. This will allow users to authenticate and receive access tokens to access the API.<br> <br> 5. API calls: Make API calls in Angular using the API service you created. This will enable you to retrieve data from the API, send data to the API, or update existing data.<br> <br> 6. Error handling: Implement proper error handling mechanisms to manage any errors that may occur during API calls. This will allow you to display appropriate error messages to users and track errors effectively.</p><p>By following these steps, you can integrate your ASP.NET Core Web APIs with Angular and build a secure Angular site. You can refer to the complete tutorial for more detailed instructions and a better understanding of the implementation process.**</p><p>This is a tutorial that can guide you to build and secure an Angular site by connecting to your ASP.NET Core Web APIs, see the below link:</p><p>[Secure Angular Site using JWT Authentication with ASP.NET Core Web API](<a href="https://codingsonata.com/secure-angular-site-using-jwt-authentication-with-asp-net-core-web-api/">https://codingsonata.com/secure-angular-site-using-jwt-authentication-with-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*LHxNyMW_8wUE7GmH4zx7cw.png" /></figure><h3>ASP.NET Core Web API Integration with Android:</h3><p>The same case as it for Angular and any web technology, you can easily integrate your ASP.NET Core Web API with mobile technology such as Android or iOS.</p><p>This is a tutorial to learn more about this integration.</p><p>[A Complete Tutorial to Connect Android with ASP.NET Core Web API](<a href="https://codingsonata.com/a-complete-tutorial-to-connect-android-with-asp-net-core-web-api/">https://codingsonata.com/a-complete-tutorial-to-connect-android-with-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*BszpqECd1Fm65HtIUwjyvg.png" /></figure><h3>Applying reCAPTCHA 3 Server Validation in ASP.NET Core Web API:</h3><p>This is very useful tutorial that will help you protect your web or mob application by applying the best spam protection tool by Google, which reCAPTCHA v3</p><p>[Google reCAPTCHA v3 Server Verification in ASP.NET Core Web API](<a href="https://codingsonata.com/google-recaptcha-v3-server-verification-in-asp-net-core-web-api/">https://codingsonata.com/google-recaptcha-v3-server-verification-in-asp-net-core-web-api/</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*Me4mIqeDI6lFjtUq6XpZUw.png" /></figure><h3>**Further online resources and materials** to learn ASP.NET Core Web API:</h3><p>- [What’s new in .NET 6](<a href="https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-6">https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-6</a>)<br>- [What’s new in ASP.NET Core 6](<a href="https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-6.0?view=aspnetcore-6.0">https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-6.0?view=aspnetcore-6.0</a>)<br>- [Announcing .NET 7 Preview 1](<a href="https://devblogs.microsoft.com/dotnet/announcing-net-7-preview-1/">https://devblogs.microsoft.com/dotnet/announcing-net-7-preview-1/</a>)<br>- [ASP.NET Core Path on PluralSight](<a href="https://www.pluralsight.com/paths/aspnet-core">https://www.pluralsight.com/paths/aspnet-core</a>)<br>- [RoundTheCode by David Grace](<a href="https://www.roundthecode.com/">https://www.roundthecode.com/</a>)</p><h3>Summary:</h3><p>To learn ASP.NET Core Web API requires a proper dedication, focus and some commitment to understand all the concepts and master this amazing technology.</p><p>You can achieve this by assigning a small proportion every day, where you can take a topic and read about it, watch some video explanation or implement a tutorial.</p><p>Day after day you will notice how knowledgeable and sold you will become. Make sure to implement whatever you learn in a side project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5338ef3b81d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Git Commands — How to Use Git in a Real Project]]></title>
            <link>https://medium.com/@fatih.akpiyal1/basic-git-commands-how-to-use-git-in-a-real-project-da336f2fb0ae?source=rss-ee5c777bab84------2</link>
            <guid isPermaLink="false">https://medium.com/p/da336f2fb0ae</guid>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Fatih Akpiyal]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 17:26:40 GMT</pubDate>
            <atom:updated>2023-06-22T17:26:40.058Z</atom:updated>
            <content:encoded><![CDATA[<h3>Basic Git Commands — How to Use Git in a Real Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWFkh5z8oa6dZfn5_gkKKQ.jpeg" /></figure><p>İn this article we will learn how to use GitHub just by CLI codes.</p><p>Git Commands: Working on Local Repositories</p><h4>· git init:</h4><p>· This command is for creating an empty Git repository.</p><p>· After this command is usedi a .git folder is created in the directory with some subdirectories.</p><h4>· git add:</h4><p>· The “git add” command is used after checking the status of files in your repository. It allows you to add specific files or changes to the staging area.</p><p>· Before the commit command, “git add” command is used for adding any new or modified files.</p><h4>· git commit:</h4><p>· This command makes sure that the changes are saved to the local repository</p><p>· This command is used as ‘git commit -m &lt;message&gt;’ which allows you to describe the changes in the code for everyone to understand.</p><h4>· git status:</h4><p>· This command used for telling us to which repository is current right now.</p><p>· The command provides the current working branch. If the files are in the staging area, but not committed, it will be shown by the git status. Also, if there are no changes, it will show the message no changes to commit, working directory clean. (P.S. The staging area is a temporary space used as a preparation area.)</p><h4>· git config:</h4><ul><li>The git config command is used initially to configure the user.name and user.email. This specifies what email id and username will be used from a local repository.</li><li>When git config is used with — global flag, it writes the settings to all repositories on the computer.</li><li>This command used as (git config — global user.name “any user name”, git config — global user.email &lt;email id&gt;)</li></ul><h4>· git branch:</h4><ul><li>The git branch command is used to determine what branch the local repository is on.</li><li>The command enables adding and deleting a branch.</li><li>For creating a new branch (git branch &lt;branch-name&gt;</li><li>For listing all remote or local branches ( git branch -a)</li><li>For deleting a branch ( git branch -d &lt;branch-name&gt;</li></ul><h4>· git checkout:</h4><ul><li>The git checkout command is used to switch branches, whenever the work is to be started on a different branch.</li><li>The command works on three separate entities: files, commits, and branches.</li><li>This are the commands (# Checkout an existing branch<br> git checkout &lt;branch_name&gt; and # Checkout and create a new branch with that name<br> git checkout -b &lt;new_branch&gt; )</li></ul><h4>· git merge:</h4><ul><li>The <a href="https://www.simplilearn.com/tutorials/git-tutorial/merge-conflicts-in-git">git merge</a> command is used to integrate the branches together. The command combines the changes from one branch to another branch.</li><li>It is used to merge the changes in the staging branch to the stable branch.</li><li>This is the syntax of the command (git merge &lt;branch_name)</li></ul><h4>· git remote:</h4><ul><li>The git remote command is used to create, view, and delete connections to other repositories.</li><li>The connections here are not like direct links into other repositories, but as bookmarks that serve as convenient names to be used as a reference.</li><li>This is the syntax of the command (git remote add origin &lt;address&gt;)</li></ul><h4>· git clone:</h4><ul><li>The git clone command is used to create a local working copy of an existing remote repository.</li><li>The command downloads the remote repository to the computer. It is equivalent to the Git init command when working with a remote repository.</li><li>This is the syntax of the command (git clone &lt;remote_URL)</li></ul><h4>· git pull:</h4><ul><li>The <a href="https://www.simplilearn.com/tutorials/git-tutorial/git-pull-request">git pull command</a> is used to fetch and merge changes from the remote repository to the local repository.</li><li>The command “git pull origin master” copies all the files from the master branch of the remote repository to the local repository.</li><li>“origin” is usually a name given to the remote repository, and “master” represents the master branch in the remote repository. This command updates the local repository with the latest changes from the remote repository.</li><li>This is the syntax of the command (git pull &lt;branch_name&gt; &lt;remote URL&gt;)</li></ul><h4>· git push:</h4><ul><li>The command <a href="https://www.simplilearn.com/tutorials/git-tutorial/git-push-command">git push</a> is used to transfer the commits or pushing the content from the local repository to the remote repository.</li><li>The command is used after a local repository has been modified, and the modifications are to be shared with the remote team members.</li><li>This is the syntax of the command (git push -u origin master)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da336f2fb0ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>