<?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 Ali Furkan Dadali on Medium]]></title>
        <description><![CDATA[Stories by Ali Furkan Dadali on Medium]]></description>
        <link>https://medium.com/@alifdadali?source=rss-8f8f6f4cbdfd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gjKbXky2_sKlAIiP3V7vRg.jpeg</url>
            <title>Stories by Ali Furkan Dadali on Medium</title>
            <link>https://medium.com/@alifdadali?source=rss-8f8f6f4cbdfd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:43:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alifdadali/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[Unit Testing in NestJS]]></title>
            <link>https://medium.com/@alifdadali/unit-testing-in-nestjs-c65cc3da0b99?source=rss-8f8f6f4cbdfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c65cc3da0b99</guid>
            <dc:creator><![CDATA[Ali Furkan Dadali]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 16:16:11 GMT</pubDate>
            <atom:updated>2022-04-05T16:19:12.404Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, today we are going to learn how to apply the unit test in NestJS but I will approach this topic like cooking to be more creative. In daily life, I like cooking as much as coding🤓. Generally, I do not prefer to match the full of recipe. I like to inspire by recipes and add some touches myself. if you’re ready, shall we start?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*UMjvEi03tz6NWV9NaYFd2g.jpeg" /></figure><h3>Ingredients</h3><h4><strong>-One Tablespoon, Knowledge about Unit Testing</strong></h4><p>Unit testing is a type of software development process of testing the smallest testable pieces of code. It is the first level of functional testing. Generally, developers write unit tests themselves. Unit tests set the ground for the extendable codebase. Ease refactoring and also we can evaluate code coverage.</p><h4>-½ Cup, Purpose of Write Unit Tests</h4><p>The main purpose of unit testing is to check that all the individual parts are working as intended. Unit testing improves code quality. It helps to detect software bugs easily. We can run tests after developing some parts of our code and we can check the new codes are suitable for the algorithm. Code coverage is also another important point. But remember that unit tests do not find out all errors.</p><h4>-One Teaspoon, Unit Testing Process</h4><ol><li>Prepping and reviewing the unit in question.</li><li>Create the test cases</li><li>Testing the code</li></ol><h4>-A Pinch of, Some Unit Test Tool Names</h4><p>Jest, Mocha, Jasmin, Junit, NUnit, JMockit, EMMA</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*9vDGKac-DW358sxnXps4sQ.png" /><figcaption>levels of testing</figcaption></figure><h3>Coding Instructions</h3><p><a href="https://docs.nestjs.com/">Documentation | NestJS - A progressive Node.js framework</a></p><p>Before starting the project, if you are super new to NestJS, you can check the documentation. You will need basics when you start the project. I am touching on What is NestJS? shortly, you could find more detail on official documentation. I am also not a master at this tool but I really like to develop with NestJS and I also develop my skills on this tool.</p><p>NestJS is a framework for building efficient and scalable Node.js server-side applications built with and fully supporting TypeScript. It uses robust HTTP Server frameworks like Express or Fastify. Nest provides a level of abstraction above the common Node.js frameworks and exposes its APIs to the developer. This gives a great amount of freedom to use third-party modules.</p><h3>1. Creating a new NestJS application</h3><p>Go to your project file path on your IDE terminal and enter create new nest project command.</p><pre>nest new FoodDeliveryApi</pre><p>Nest will automatically create a new project with basic dependencies. In the second step, we need to add services to our project you can do it manually but I prefer to add with terminal commands. We’ll add two services. API and Orders.</p><pre>nest g service orders<br>nest g service api</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*UvodVDQSofvNtwXg_l57KA.png" /><figcaption>example screenshot</figcaption></figure><p>we are almost done before touching on code but let’s check is everything okay and running correctly before starting development.</p><pre>nest start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*ve8wqXvQzc_M6Jbe885nig.png" /><figcaption>Running nest app</figcaption></figure><p>File explorer structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*qV73vzDFvy-yomPWQKR2lg.png" /></figure><p>Now, in our project, we build a simple API project. The main goal of the project is to get order details by UserId. The class OrderService is defined in order.service.ts includes a function that takes the id parameter and returns order details data. Order service uses the other class called API service defined in api.service.ts to get order information in real cases. (touch the database, other services, etc.) NestJS make unit test possible support by JestJS. When we create new services test files are created automatically. Test files involving in .spec.ts files. We will add our codes for testing into spec.ts files.</p><p>Before coding our test modules I need to explain our project for what we are going to use it? We will define a method that includes basic math formula for calculating a customer&#39;s special discount rate. We will call the customer&#39;s last three orders from API service and if the order price is upper than 50 we take five percent of the price then by we sum for three orders totally we will get the discount value. Last rule our discount value can’t be higher than 20. When it reaches 20 or passes over, we will set it down to 20.</p><p>Our spec.ts file represents test files. We are adding our test codes into that files and every test file will run by oneself. I will share an example of running test output when we get failed. (Also I created two memes in this article. I hope you’ll like it. 😊 )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*9l0KRDei24rlPSfiduu9jg.png" /><figcaption>possible outputs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*5E91DtUaKfanIDj45dOQaw.jpeg" /><figcaption>How does it feel in case of a situation like the upper image</figcaption></figure><p>Unit testing has some significant concepts. I will share these keywords with scenarios to easily understandable.</p><h4>Mock Functions</h4><p>Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function (and the parameters passed in those calls), capturing instances of constructor functions when instantiated with, and allowing test-time configuration of return values. (<a href="https://jestjs.io/docs/mock-functions">here</a>)</p><p>For our project, we need to get customer&#39;s orders information. But while unit tests running we have to mock real API calls. Unit tests have to work for the case of unit tests. We create a spy orders service and if we want to get orders we run a spy service and it is return orders to us which are we created for the test case.</p><h4>Spy</h4><p>Make sure a particular method has been called.</p><h4>Spying on the constructor<a href="https://jestjs.io/docs/es6-class-mocks#spying-on-the-constructor">​</a></h4><p>In order to track calls to the constructor, replace the function returned by the HOF with a Jest mock function. Create it with <a href="https://jestjs.io/docs/jest-object#jestfnimplementation">jest.fn()</a>, and then specify its implementation with mockImplementation(). (<a href="https://jestjs.io/docs/es6-class-mocks#keeping-track-of-usage-spying-on-the-mock">here</a>)</p><h4>Fakes</h4><p>Fakes are objects that have working implementations but are not the same as production ones. Usually, they take some shortcuts and have a simplified version of production code. (more detail <a href="https://www.softwaretestingmagazine.com/knowledge/unit-testing-fakes-mocks-and-stubs/">here</a>!)</p><h4>Stub</h4><p>A stub is an object that holds predefined data and uses it to answer calls during tests. It is used when you can’t or don’t want to involve objects that would answer with real data or have undesirable side effects. (more detail <a href="https://www.softwaretestingmagazine.com/knowledge/unit-testing-fakes-mocks-and-stubs/">here</a>!)</p><p>I have mentioned about we add test codes to our spec.ts files. Now lest review project codes. (You can find the project GitHub link below and you can download and run it. Free to try 😊)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc36917fb0b339ec3404a2b31aea1452/href">https://medium.com/media/fc36917fb0b339ec3404a2b31aea1452/href</a></iframe><p>as you can see on line 10 we use beforeEach and If you have some work you need to do repeatedly for many tests, you can use beforeEach and afterEach. beforeEach and afterEach can handle asynchronous code in the same ways that tests can handle asynchronous code — they can either take a done parameter or return a promise. For example, if initializeCityDatabase() returned a promise that resolved when the database was initialized, we would want to return that promise:</p><p>We define <strong>testService </strong>now we will call from spy service. We mock real services and processes from fake parameters. We defined userId as you can see and called orders which we defined in the orders.service.spec.ts file with this id.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f0bdd2c8b4b2f8c2a1adce072e26193/href">https://medium.com/media/5f0bdd2c8b4b2f8c2a1adce072e26193/href</a></iframe><p>We mocked API service to block send call real service and define data here. The calculated discount value is 15 for our order data it has to return 15. Ours described function playing a role in that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1b0e36c3f36a9af04149a7b45a29ad0d/href">https://medium.com/media/1b0e36c3f36a9af04149a7b45a29ad0d/href</a></iframe><p>Let&#39;s run tests!</p><pre>npm run test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*IB3aRzycfE1C_Ufk2MBXUA.png" /></figure><p>Tests provide all expected results from our services. When we see some green and it always puts our faces a little smile 😊 I hope this content helped you to see the basics of unit testing.</p><p><strong>GITHUB:</strong> <a href="https://github.com/furkandadali/Unit-Testing-in-NestJS">https://github.com/furkandadali/Unit-Testing-in-NestJS</a></p><p>Thanks for reading.</p><p>Feel free to comment and clap if you enjoyed ✌️</p><p>REFERENCES</p><p><a href="https://www.gordonramsay.com/gr/recipes/everythingdip/">https://www.gordonramsay.com/gr/recipes/everythingdip/</a> (I use it as a recipe template ☺️)</p><p><a href="https://jestjs.io/">https://jestjs.io/</a></p><ul><li><a href="https://www.carloscaballero.io/part-10-clock-in-out-system-testing-backend-unit-test-controllers/">Part 10. Testing: Backend Testing - Unit Testing - Controllers</a></li><li><a href="https://www.carloscaballero.io/part-9-clock-in-out-system-testing-backend-unit-test-services/">Part 9. Testing: Backend Testing - Unit Testing - Services</a></li><li><a href="https://selleo.com/blog/why-choose-nest-js-as-your-backend-framework">➤ Why Choose NestJS As Your Backend Framework? 🤔</a></li><li><a href="https://docs.nestjs.com/fundamentals/testing">Documentation | NestJS - A progressive Node.js framework</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c65cc3da0b99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add your NuGet package in Azure DevOps?]]></title>
            <link>https://medium.com/@alifdadali/how-to-add-your-nuget-package-in-azure-devops-a32a5fda509f?source=rss-8f8f6f4cbdfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a32a5fda509f</guid>
            <category><![CDATA[artifact]]></category>
            <category><![CDATA[nuget-package]]></category>
            <category><![CDATA[azure-devops]]></category>
            <dc:creator><![CDATA[Ali Furkan Dadali]]></dc:creator>
            <pubDate>Fri, 04 Mar 2022 05:53:22 GMT</pubDate>
            <atom:updated>2022-03-04T05:53:22.425Z</atom:updated>
            <content:encoded><![CDATA[<h4>(Part Two)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*XIPDCdjMwmN7bz2n_FAmNQ.jpeg" /></figure><p>Hi everyone, I shared How to create a NuGet package and publish it on nuget.org in my previous story(<a href="https://medium.com/@alifdadali/create-nuget-package-with-net-d679f589804e">If you have not reviewed part one you can go here.</a>). It was part one and Today we will see How to add your package in Azure. In this way, you will be able to share packages with your team or company. Also, you can set up permission for specific packages. See who downloaded or changed. It is a useful way to use your frameworks on solutions.</p><p>Before starting, I want to give some introduction about Azure DevOps Services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*VenD3WeyhrZ2JopaHNht4A.png" /></figure><p><strong>What is Azure DevOps?</strong></p><p>Azure DevOps provides developer services for allowing teams to plan work, collaborate on code development, and build and deploy applications. Azure DevOps supports a collaborative culture and set of processes that bring together developers, project managers, and contributors to develop software. It allows organizations to create and improve products at a faster pace than they can with traditional software development approaches.</p><p><a href="https://docs.microsoft.com/en-us/azure/devops/user-guide/what-is-azure-devops?view=azure-devops">What is Azure DevOps? - Azure DevOps</a></p><p><strong>What is Azure Artifacts?</strong></p><p>Azure Artifacts enable developers to consume and publish different types of packages to Artifacts feeds and public registries such as NuGet.org and npmjs.com. You can use Azure Artifacts in conjunction with Azure Pipelines to deploy packages, publish build artifacts, or integrate files between your pipeline stages to build, test, or deploy your application.</p><p>Add fully integrated package management to your continuous integration/continuous delivery (CI/CD) pipelines with a single click.</p><p><a href="https://azure.microsoft.com/en-us/services/devops/artifacts/">Azure Artifacts | Microsoft Azure</a></p><p><strong>How to add your package in Azure Artifacts?</strong></p><p>We created Security.Enigma NuGet package in the previous story (<a href="https://medium.com/@alifdadali/create-nuget-package-with-net-d679f589804e">part one</a>), we will publish it on Azure Artifacts.</p><p>Firstly go to <a href="https://dev.azure.com/">https://dev.azure.com/</a> address and sign-in. If it is your first sign-in, create an organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1JMgQ9R690gPzpeeYkuVg.png" /></figure><p>I give the name to my organization alidadali, It will be just a demo platform. Then I created a new project on the <em>new project</em> button. I did not customize the settings, use the default settings recommended by Microsoft.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfcrCbN33LgIbeCeqRtsgw.png" /></figure><p>The next step is, add a new feed into Artifacts. Click artifact and create a new feed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*21B2j5fHcxthE-3TwgUbXg.png" /></figure><p>We will connect our feed from the visual studio. Firstly click the connect feed and choose the visual studio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QIeCbSFjK-ZMfxYLwYsEQA.png" /></figure><p>Now, firstly we will add our feed as a source to package manager solution on visual studio.</p><p>go to nuget.solution and click the gear icon</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCwf6NaN1PlBVz_uOPd4aw.png" /></figure><p>Then click the green plus button and add our feeds credentials copy from the feed screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*dxSWh1OOAI_TY8kgddJIsQ.png" /></figure><p>Now we have added a package source to the solution. Now go back to the Azure portal and we need some preparations before pushing the package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQMos_L3wFcYYA3oZxGknA.png" /><figcaption>image number 9.0</figcaption></figure><p>Go to the NuGet tab on connect feed screen and Click the get tools before running push commands on Developer PowerShell. Follow the requirements. It will set your credential provider on Powershell. Otherwise, you will not be able to connect your feed. After complete the requirements create nuget.config file for your project, at the same level as your .sln file.</p><p>Follow the steps on image number 9.0, If you add a config file before the add source your package manager solution, it will automatically add to your config file after adding your source.</p><p>Go back to the visual studio and open the Developer Powershell. When you open in visual studio, it will automatically run the same directory with your project solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*UoWwd7kZbMyKPcVhzcxYGg.png" /></figure><p>Don’t forget to move your nuget.exe (downloaded from <em>get tools</em>) to a specific path. You need to give the exact path before running the command.</p><p>After that run this command: “cd <em>your_package_path”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*hxVrh9U609gzhhCYWOe16A.png" /></figure><p>we will run</p><p><strong>nuget_exe_path</strong>\nuget.exe push -Source “<strong>source_Name</strong>” -ApiKey <strong>key_Value</strong> <strong>package_name_with_type</strong></p><p>this command is properly according to our solution. I marked input parts that you are going to define.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*mMcpuIlTzBHFpMOnrVh4OQ.png" /><figcaption>This image will make you happy! :)</figcaption></figure><p>You will get notified that like in this image. Now let’s check to our feed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7vscKKVtX_oWAJnxb1DGYg.png" /></figure><p>as you can see added to our feed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jq9qtq2pHRdYzyapiH3zNQ.png" /></figure><p>also, we can reach from visual studio NuGet package manager solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bglep5WNPVSvAl0bopW7Sg.png" /></figure><p>In this way, we are able to share packages for the team or company members as we prefer. Also, be able to set permissions and follow updates. If you have pipelines, you can associate each other for the versioning and publishing automatically.</p><p>You can find the full project on my Github profile. <a href="https://github.com/furkandadali/Custom-NuGet-Packages">https://github.com/furkandadali/Custom-NuGet-Packages</a></p><p>nuget.org package link: <a href="https://www.nuget.org/packages/Company.Security.Enigma/">https://www.nuget.org/packages/Company.Security.Enigma/</a></p><p>Thanks for reading.</p><p>Feel free to comment and clap if you enjoyed ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a32a5fda509f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create NuGet Package with .NET]]></title>
            <link>https://medium.com/@alifdadali/create-nuget-package-with-net-d679f589804e?source=rss-8f8f6f4cbdfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d679f589804e</guid>
            <category><![CDATA[nuget-package]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[decryption]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Ali Furkan Dadali]]></dc:creator>
            <pubDate>Thu, 03 Mar 2022 09:33:11 GMT</pubDate>
            <atom:updated>2022-03-03T09:33:11.277Z</atom:updated>
            <content:encoded><![CDATA[<h3>Create NuGet Package with .NET</h3><h4>(Part One)</h4><p>Hello everyone, before starting let me give some preliminary information. I am trying to make my stories short as far as possible. Because time is the most valuable thing in life. When you have time to read my stories I try to do my best to use your time beneficial. 😊 This story will be a series including two-part. I will share <strong>part two</strong> on the following day.</p><p><strong>Part One</strong>: Create and publish NuGet Package with .Net</p><p><strong>Part Two</strong>: How to add your NuGet package in Azure Cloud Service?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-y2EkR6HOMNmHdrM1Ur_w.png" /></figure><p><strong>What is NuGet?</strong></p><p>I will try to explain an example, what is NuGet? You start to develop a new project and it is created by microservices architecture. You need to separate your business into the little parts and probably they will have common classes for the execute core tasks. If you add manually same classes (which for log or notification etc.) have a single responsibility, it would be a loss of time to recode and add the same classes every single time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*h507x-LHxoM5KQj6CSik6A.jpeg" /></figure><p>Imagine you turn these classes into a package for your solution as private or public. When you need it, just install it to your solution and call them with ‘using’ one line code. If there is a confidential issue you can share that just with your team and if you want to contribute and reach other programmers share on <a href="http://nuget.org/">nuget.org</a> 😇 Sounds exciting isn’t it? 🤓</p><p>So technically NuGet is a package manager for developers. Designed for the Microsoft Development platform.</p><p><a href="https://docs.microsoft.com/en-us/nuget/">You can find more detail about NuGet</a> -&gt;</p><p><a href="https://docs.microsoft.com/en-us/nuget/">NuGet documentation</a></p><p><strong>Prerequisites</strong></p><ul><li>Visual Studio (I use version 2022 and .Net 6)</li><li>nuget.org account(It is free to sign up.)</li><li>If you want to add the package to your Azure service, you can create an account. You’ll have <strong>30 days</strong> to use it — in addition to free services.</li></ul><p><strong>Let’s Create a NuGet Package!</strong></p><p>The first step selects the project type. I want to create a Security package which is encryption and decryption classes. We can use that for the save password, DB connection parameters some credentials may be some confidential keys.</p><p>Select Class library and click next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*U9Asa6StX4nErH9UqKVizA.png" /></figure><p>Give a name to the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*WIxXEitj1z1vsDSOkYt8DQ.png" /></figure><p>I added my classes which are Encryption and Decryption.</p><p>I use <strong>System.Security.Cryptography</strong> library for these operations. After published.Net6 obsoleted some types in this library(like SYSLIB0021). Please follow this <a href="https://docs.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/obsoletions-overview">link </a>to catch the last updates.</p><p><strong>Encryption class.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5cb3589bb9aa8879a65330be3abfb9cd/href">https://medium.com/media/5cb3589bb9aa8879a65330be3abfb9cd/href</a></iframe><p><strong>Decryption Class</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b070dc20d6f62fd2ecbd90ca55d9d8b/href">https://medium.com/media/6b070dc20d6f62fd2ecbd90ca55d9d8b/href</a></iframe><p><strong>How does it work?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GuCciuFjNFDZoasS2mcbGg.png" /></figure><p>Our structure seems like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*72J0j1ARL699g1mAWsx7xw.png" /></figure><p>After added classes, we will make provision for the pack of our project into the NuGet package.</p><p>Go to properties of Security.Enigma Project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bq73hAGXxpCT3dZELxS3JQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aP1eEdjWtoOdvwQEGXovsg.png" /></figure><p>Already have explanations about these inputs but I will give some details about how I fill inputs in this tab.</p><ul><li>PackageId : Define your package name.</li><li>Package Version: Default value 1.0.0 if you add a new extension or option to your package when you update it also you can update your version here.</li><li>Description: also useful for the users. After you publish it developers can understand quickly what is used for.</li><li>Licencing: If you have a unique license you can add. If you don&#39;t describe it almost nobody will be able to use it. It is also changed in visual studio version 2022. MIT is the common one.<a href="https://spdx.org/licenses/"><strong><em> Please check</em></strong></a>!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kg5gAqXtcxO2cpkOgNBilw.png" /></figure><ul><li>Icon Url: You can add icon. I think that makes them cute :)</li><li>Tags: It is also important to find your package from developers. You can put some keywords about your package.</li></ul><p>After finishing to give those informations to our code we are ready to pack it.</p><p>Click right and pack it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*bWIJH7ak6OKUwa6Qj9Uu2A.png" /></figure><p>After completing the packing process you will have a notification on the output window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9QuTuBEZ-JiKK8m-48iMQ.png" /></figure><p>If you copy created package URL which is end with .nupkg. This will make it easier to find a package while publishing.</p><p><strong>Publishing</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*UGpP92pieyyqEEGieUW8dQ.png" /></figure><p>Go to <a href="http://nuget.org/">nuget.org</a> and sign in. On the profile tab, click the<em> Upload Package</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDTYY92WJrxDFKpDgZFZbw.png" /></figure><p>Click the browse button and paste your package path which we copied from the output window. Before the publish you need to check your package information on the preview screen and if everything looks okay click the publish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0VDjq6k94iFLr-VK68RAQ.png" /></figure><p>After clicking the publish button this screen will be waiting for you. It shows it might take a few minutes to a few hours. When your package is published NuGet will notify you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*roO3MydmtKZli1Rz8Bq75w.png" /></figure><p><strong>Your package is published!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rxgFJFLVv6ffVevdLDjmGQ.png" /></figure><p>Also, You can search your package in the NuGet package solution on visual studio and include it in your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Prg_aGtTOeZ1CRdnw-bw7g.png" /></figure><p>You can find the full project on my Github profile. <a href="https://github.com/furkandadali/Custom-NuGet-Packages">https://github.com/furkandadali/Custom-NuGet-Packages</a></p><p>nuget.org package link: <a href="https://www.nuget.org/packages/Company.Security.Enigma/">https://www.nuget.org/packages/Company.Security.Enigma/</a></p><p>Thanks for reading.</p><p>Feel free to comment and clap if you enjoyed ✌️</p><p><strong><em>REFERENCES</em></strong></p><ul><li><a href="https://docs.microsoft.com/en-us/nuget/">NuGet documentation</a></li><li><a href="https://docs.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/syslib0021">SYSLIB0021 warning - .NET</a></li><li><a href="https://www.youtube.com/c/dotNET/about">dotNET</a></li><li><a href="https://spdx.org/licenses/">Software Package Data Exchange (SPDX)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d679f589804e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using the CQRS Design Pattern in .Net 6]]></title>
            <link>https://medium.com/@alifdadali/using-the-cqrs-design-pattern-in-net-6-b0402f6bc29a?source=rss-8f8f6f4cbdfd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0402f6bc29a</guid>
            <category><![CDATA[cqrs]]></category>
            <category><![CDATA[net6]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Ali Furkan Dadali]]></dc:creator>
            <pubDate>Thu, 17 Feb 2022 15:56:54 GMT</pubDate>
            <atom:updated>2022-02-17T20:01:31.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using the CQRS Design Pattern in .Net 6</h3><p>Hi everyone, This is my first writing about programming. That makes it more important for me to choose a topic. When I have worked with Ahmet Sertay Halka, I have heard about CQRS Design Pattern first time from him, and also Move all projects to CQRS DP was the My first task. About 1 year ago when I heard that I was quite excited. Accordingly, It would be a good choice for the first writing. 😊</p><p>Let me share a scenario with you before diving teorical part. I believe that when you imagine the issue in your mind, understanding complex things getting easier. If your coffee is ready let&#39;s start.☕️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*BCx6CXtUD6V-8fjmqGbQSg.jpeg" /><figcaption>Be careful! This Story includes high caffeine !!</figcaption></figure><p>Please think that you are going to one of the most popular coffee shop in world. And It is rush hour. Everybody has limited time and place getting crowded. But we have a problem there is only one point to order and take away your order from. What? 😱</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*fZUfTgTInRO3XO9giZ8awg.jpeg" /><figcaption>this is getting serious..</figcaption></figure><p>Of course, the cashier working asynchronously. Keep going to take the order and give the order when get ready. Could you imagine that complexity? But actually, how does it work in real life? It is different points to make an order and take your coffee when it&#39;s ready. I think we start to fill some gaps. Let’s see how it is processed for CQRS.</p><p>What is CQRS?</p><p>CQRS stands for Command Query Responsibility Segregation. The first explanation about CQRS be thought from Greg young. And Also Command Query Responsibility Segregation (CQRS) architectures expand the concept of command query division at the architectural level. But these architectures are not architectures of the whole software system. It is a design of just one part of the software and that part is called the Application Layer. Why it makes CQRS a design pattern. By the means, CQRS includes important benefits for our system which flexibility, scalable, performance measuring, able to security improvements.</p><p>We will inspect three different main types of CQRS.</p><ol><li>Working with Single Database</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*JlsRr7IFvraY_IzwxThgdg.png" /></figure><p>As you can see in this schema, commands, and queries work on the same database. We are transferring commands into the Database by the ORM tool and we can also Query them by the ORM tool using LINQ, store procedures, etc. It depends on what you are using as an ORM tool.</p><p>2. Separate Command and Query Databases</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*yMnH51x2rc8V83T6rdgNZA.png" /></figure><p>for schema two, as we can see on write database works for Create, Update, Delete tasks. All query charge works on Read Database. In this way, we purify Write Database from query load. We could have faster queries.</p><p>3. CQRS- Event Source 😎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*3Blv9UHyMC0oaTQ6SN47pw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*ptz8laugEeC0qvq7EA6cPg.png" /></figure><p>As you can see, the “read” part remains unchanged. The “write” database is now represented by the queue of events (event store). The “write” part of the application publishes events (commands) in the queue (it can be a Kafka topic, for example). The event handler is the component that consumes events from the event store, and using these events, it updates data in the “read” database. So, the current states of the entities are stored only in the “read” database. All the history of entity transformation can be extracted using a sequence of the events that is stored in the “write” database. CQRS architecture is implemented by a separation of responsibilities between commands and queries. The event sourcing principle is implemented by using the sequence of events to track changes of data. <strong>(ref 1.0.0)</strong></p><h3>After sharing some technical information, shall we create a new project?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45VDnpqGzB9UhMLhIT0rIA.png" /></figure><p>Firstly we create a new project as an API project. It will give you also swagger UI package already implemented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jS1nXdFdiGpZ6dno8fHTbw.png" /></figure><p>this screen will be the next screen waiting. for us. Checkboxes how do you prefer and click Next.</p><p>After creating the first project we need to add a class library project for the business layer.</p><p>Right-click on solution and follow the tabs =&gt; Add =&gt; New Project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FvxP5aXBpzWaD8rUQcqtMg.png" /></figure><p>Just before done project creates step we need to add references between projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3CXqWOlakLKnmYmgBpg3g.png" /></figure><p>We created a project in.Net6. I use the new features on that project came with .Net6. Please check <a href="https://docs.microsoft.com/en-us/dotnet/core/compatibility/6.0"><strong>https://docs.microsoft.com/en-us/dotnet/core/compatibility/6.0</strong></a><strong> </strong>for these new features. I added the GitHub link below for the project code. I didn&#39;t add source code in here because I want to make the story easy to read 😇 also I tried to code the project noncomplicated.</p><p><strong><em>GITHUB: </em></strong><a href="https://github.com/furkandadali/Using-the-CQRS-Design-Pattern-in-.Net6">https://github.com/furkandadali/Using-the-CQRS-Design-Pattern-in-.Net6</a></p><p>Thanks for reading.</p><p>Feel free to comment and clap if you enjoyed ✌️</p><p><strong><em>REFERENCES</em></strong></p><p><a href="https://levelup.gitconnected.com/3-cqrs-architectures-that-every-software-architect-should-know-a7f69aae8b6c">https://levelup.gitconnected.com/3-cqrs-architectures-that-every-software-architect-should-know-a7f69aae8b6c</a></p><p><a href="https://docs.microsoft.com/tr-tr/dotnet/core/compatibility/6.0">https://docs.microsoft.com/tr-tr/dotnet/core/compatibility/6.0</a></p><p><a href="https://letienthanh0212.medium.com/cqrs-and-mediator-in-net-core-project-c0b477eab6e9">https://letienthanh0212.medium.com/cqrs-and-mediator-in-net-core-project-c0b477eab6e9</a></p><p><a href="https://martinfowler.com/bliki/CQRS.html#:~:text=CQRS%20stands%20for%20Command%20Query,you%20use%20to%20read%20information.">https://martinfowler.com/bliki/CQRS.html#:~:text=CQRS%20stands%20for%20Command%20Query,you%20use%20to%20read%20information.</a></p><p><a href="https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs">https://docs.microsoft.com/en-us/azure/architecture/patterns/cqrs</a></p><p>(Ref no : 1.0.0) <a href="https://www.upsolver.com/blog/cqrs-event-sourcing-build-database-architecture#:~:text=Event%20sourcing%20is%20an%20approach,tightly%20related%20to%20event%20sourcing">https://www.upsolver.com/blog/cqrs-event-sourcing-build-database-architecture#:~:text=Event%20sourcing%20is%20an%20approach,tightly%20related%20to%20event%20sourcing</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0402f6bc29a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>