<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zenrac</title>
    <description>The latest articles on DEV Community by Zenrac (@zenrac).</description>
    <link>https://dev.to/zenrac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F538274%2Fc51c6fce-946c-44c0-b999-110f61e095ad.png</url>
      <title>DEV Community: Zenrac</title>
      <link>https://dev.to/zenrac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zenrac"/>
    <language>en</language>
    <item>
      <title>Generate your own application with the CQRS design pattern thanks to JHipster.NET</title>
      <dc:creator>Zenrac</dc:creator>
      <pubDate>Fri, 23 Jul 2021 14:18:41 +0000</pubDate>
      <link>https://dev.to/zenrac/generate-your-own-application-with-the-cqrs-design-pattern-thanks-to-jhipster-net-pme</link>
      <guid>https://dev.to/zenrac/generate-your-own-application-with-the-cqrs-design-pattern-thanks-to-jhipster-net-pme</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foorsm4txytcwudekpunw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foorsm4txytcwudekpunw.png" alt="JHipster CQRS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.jhipster.tech/" rel="noopener noreferrer"&gt;&lt;strong&gt;JHipster&lt;/strong&gt;&lt;/a&gt; is a famous generator allowing you to generate modern applications.&lt;/p&gt;

&lt;p&gt;One of its official blueprints is called &lt;a href="https://github.com/jhipster/jhipster-dotnetcore" rel="noopener noreferrer"&gt;&lt;strong&gt;JHipster.NET&lt;/strong&gt;&lt;/a&gt;. It allows to override the back-end part in asp.net core (instead of Java spring boot).&lt;/p&gt;

&lt;p&gt;To take advantage of this blueprint, we will generate a modern application which implements the Mediator and CQRS pattern.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why CQRS ?
&lt;/h1&gt;

&lt;p&gt;CQRS stands for Command Query Responsibility Segregation. In .NET you have the possibility to easily implement this pattern thanks to &lt;a href="https://github.com/jbogard/MediatR" rel="noopener noreferrer"&gt;MediatR&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This pattern separates a service’s write tasks from its read tasks. While reading and writing to the same database is acceptable for small applications, distributed applications operating at web-scale require a segmented approach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Modern pattern that is more and more used in many projects.&lt;/li&gt;
&lt;li&gt;It’s secure, it allows to make sure that queries are not able to do “write” operations, as they souldn’t do.&lt;/li&gt;
&lt;li&gt;Separating write and read activities allows you to use the best database technology for the task at hand, for example, a SQL database for writing and a non-SQL database for reading.&lt;/li&gt;
&lt;li&gt;It also helps with balance loading and performance balancing. Read activity tends to be more frequent than writing, you can reduce response latency by placing read data sources in strategic geolocations for better performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cons
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You have to ensure that your data is consistant between your database.&lt;/li&gt;
&lt;li&gt;This pattern is difficult/nearly impossible to implement to an already existing project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hopefully, thanks to JHipster implementing CQRS to your application isn’t a big deal.&lt;/p&gt;

&lt;h1&gt;
  
  
  MediatR
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F624%2F0%2An003UQGEP5CoprcV" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F624%2F0%2An003UQGEP5CoprcV" alt="Mediator pattern"&gt;&lt;/a&gt;&lt;br&gt;
In order to easily implement the CQRS pattern, JHipster uses MediatR which implements the Mediator pattern.&lt;/p&gt;

&lt;p&gt;The Mediator pattern adds a layer called Application which allows to separate your commands and queries. Meaning that your controllers delegate all the CRUD logic to your Application layer, then your Application layer finds which database it needs to interact with, which service/repository to use etc...&lt;/p&gt;
&lt;h3&gt;
  
  
  Taking advantage of MediatR to implements CQRS
&lt;/h3&gt;

&lt;p&gt;The easiest way to implement CQRS with the Mediator pattern is to add ReadOnlyRepositories. Those repositories will be used by queries, when your commands will use the original repositories. Thanks to that, your commands and queries will be separated.&lt;/p&gt;
&lt;h1&gt;
  
  
  CQRS with JHipster
&lt;/h1&gt;
&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;You may find more information about how to generate your ASP.NET Core application with JHipster.NET in &lt;a href="https://dev.to/nicolas63/generate-your-asp-net-core-application-with-jhipster-net-2f53"&gt;this post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When generating your application, you can choose to use CQRS.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F365%2F1%2AcgFD_ln5WQdjQWfQ4L6GiA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fmax%2F365%2F1%2AcgFD_ln5WQdjQWfQ4L6GiA.png" alt="Choose to enable CQRS"&gt;&lt;/a&gt;&lt;br&gt;
Make sure to answer Y to enable CQRS.&lt;/p&gt;

&lt;p&gt;Enabling it will generate a new “Application” layer (a new solution in your C#) for your commands and queries.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── Namespace.Application
│   ├── Commands                             - Your commands
│   │   ├── MyEntity                         - Your entity
│   │   │   ├── MyEntityCreateCommand        - A command
│   │   │   ├── MyEntityCreateCommandHandler - A command handler
│   ├── Queries                              - Your queries
│   │   ├── MyEntity                         - Your entity
│   │   │   ├── MyEntityGetQuery             - A query
│   │   │   ├── MyEntityGetQueryHandler      - A query handler
├── Namespace.Crosscutting
├── Namespace.Domain
├── Namespace.Domain.Services
├── Namespace.Dto
├── Namespace.Infrastructure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  How to create queries/commands
&lt;/h1&gt;

&lt;p&gt;In order to create your own commands and/or queries you have to create two classes :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A command/query&lt;/li&gt;
&lt;li&gt;An handler for it&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Automatically
&lt;/h3&gt;

&lt;p&gt;JHipster allows to automatically generates entities. Read &lt;a href="https://dev.to/nicolas63/generate-your-asp-net-core-application-with-jhipster-net-2f53"&gt;this article to get started&lt;/a&gt;. Of course it will automatically generates your entities following the CQRS pattern with their commands/queries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Manually
&lt;/h3&gt;

&lt;p&gt;If you want to create your very own commands/queries, here’s an example :&lt;br&gt;
First, let’s create a query &lt;code&gt;MyEntityGetQuery.cs&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;MyCompany.Application.Queries&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyEntityGetQuery&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IRequest&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyEntity&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Query should have an Id and returns a MyEntity object. Here’s the handler &lt;code&gt;MyEntityGetQueryHandler.cs&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;MyCompany.Application.Queries&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyEntityGetQueryHandler&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IRequestHandler&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyEntityGetQuery&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MyEntity&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="n"&gt;IReadOnlyMyEntityRepository&lt;/span&gt; &lt;span class="n"&gt;_myEntityRepository&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;MyEntityGetQueryHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IReadOnlyMyEntityRepository&lt;/span&gt; &lt;span class="n"&gt;myEntityRepository&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;_myEntityRepository&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;myEntityRepository&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyEntity&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;Handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyEntityGetQuery&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;cancellationToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_myEntityRepository&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;QueryHelper&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetOneAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myEntity&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;myEntity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please note that we are using a &lt;code&gt;ReadOnlyRepository&lt;/code&gt; rather than a service in order to do the segregation between Commands and Queries. Lastly, create your routing method within your controller :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;HttpGet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"my-entity/{id}"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IActionResult&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;GetMyEntity&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;FromRoute&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_mediator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;MyEntityGetQuery&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;Id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ActionResultUtil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WrapOrNotFound&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Now you should be able to generate a modern CQRS Application thanks to JHipster !&lt;br&gt;
Feel free to contribute to &lt;a href="https://github.com/jhipster/jhipster-dotnetcore" rel="noopener noreferrer"&gt;JHipster.NET’s GitHub repository&lt;/a&gt; and don’t forget to put a star if you liked it.&lt;/p&gt;

</description>
      <category>cqrs</category>
      <category>mediator</category>
      <category>mediatr</category>
      <category>jhipster</category>
    </item>
    <item>
      <title>Generate your own application with End-to-End testing thanks to JHipster.NET</title>
      <dc:creator>Zenrac</dc:creator>
      <pubDate>Fri, 23 Jul 2021 14:12:29 +0000</pubDate>
      <link>https://dev.to/zenrac/generate-your-own-application-with-end-to-end-testing-thanks-to-jhipster-net-1f4l</link>
      <guid>https://dev.to/zenrac/generate-your-own-application-with-end-to-end-testing-thanks-to-jhipster-net-1f4l</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1BeZZEzu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vv4pti8hy5artx48i2z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1BeZZEzu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1vv4pti8hy5artx48i2z.png" alt="JHipster.NET and Cypress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;When &lt;a href="https://zenrac.medium.com/generate-your-asp-net-core-application-with-jhipster-net-377315c43e71"&gt;generating your application with JHipster.NET&lt;/a&gt;, you can decide to generate some optional Tests :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance tests with &lt;a href="http://gatling.io/"&gt;Gatling&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Behaviour-driven tests with &lt;a href="https://cucumber.io/"&gt;Cucumber&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Angular/React/Vue integration tests with &lt;a href="https://www.cypress.io/"&gt;Cypress&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Today we're going to talk about &lt;a href="https://www.cypress.io/"&gt;Cypress&lt;/a&gt;, a next generation front end testing tool built for the modern web.&lt;/p&gt;

&lt;h1&gt;
  
  
  Generate Cypress tests
&lt;/h1&gt;

&lt;p&gt;When generating your application, make sure to select Cypress (by pressing the space bar).&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oTPTnWxt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/636/1%2AT8YsyVY7Oe2a7y_c4BuDzg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oTPTnWxt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/636/1%2AT8YsyVY7Oe2a7y_c4BuDzg.png" alt="Choose Cypress"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Run your Cypress tests
&lt;/h1&gt;

&lt;p&gt;Once your application is generated, you can optionally add some entities (check &lt;a href="https://zenrac.medium.com/generate-your-asp-net-core-application-with-jhipster-net-377315c43e71"&gt;this article&lt;/a&gt; to get started with entity generation), it will auto-generate the corresponding tests for your entities. Execute cypress using this command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/YourApplication/ClientApp/node_modules/.bin/cypress open
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Now you should be able to generate End-To-End tests though Cypress thanks to JHipster !&lt;br&gt;
Feel free to contribute to JHipster.NET's GitHub repository and don't forget to put a star if you liked it.&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>jhipster</category>
      <category>e2e</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Generate your first Xamarin application with JHipster.NET</title>
      <dc:creator>Zenrac</dc:creator>
      <pubDate>Fri, 26 Feb 2021 10:31:05 +0000</pubDate>
      <link>https://dev.to/zenrac/generate-your-first-xamarin-application-with-jhipster-net-2lg3</link>
      <guid>https://dev.to/zenrac/generate-your-first-xamarin-application-with-jhipster-net-2lg3</guid>
      <description>&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.jhipster.tech/"&gt;JHipster&lt;/a&gt;&lt;/strong&gt; is a famous generator allowing you to generate modern applications. &lt;/p&gt;

&lt;p&gt;One of its official blueprints is called &lt;strong&gt;&lt;a href="https://github.com/jhipster/jhipster-dotnetcore"&gt;JHipster.NET&lt;/a&gt;&lt;/strong&gt;. It allows to override the back-end part in asp.net core (instead of Java spring boot). &lt;/p&gt;

&lt;p&gt;To take advantage of this blueprint, we will generate a modern application with a xamarin front-end. Meaning that both front-end and back-end will use C#.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Xamarin ?
&lt;/h3&gt;

&lt;p&gt;With a C#-shared codebase, developers can use Xamarin tools to write native Android, iOS, and Windows apps with native user interfaces and share code across multiple platforms, including Windows, macOS, and Linux.&lt;/p&gt;

&lt;p&gt;Choosing Xamarin allows to make a modern cross platform application with next to zero code duplication and waste of time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;You may find more information about how to generate your asp.net core application with JHipster.NET &lt;strong&gt;&lt;a href="https://dev.to/nicolas63/generate-your-asp-net-core-application-with-jhipster-net-2f53"&gt;in this post&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;To install JHipster generator, run this command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; generator-jhipster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To install JHipster.NET blueprint, run the following command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; generator-jhipster-dotnetcore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Move to any empy folder you want to, and generate your full-stack app by running this command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jhipster &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--blueprints&lt;/span&gt; dotnetcore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything goes as expected, you should have few question to answer. For instance, first questions will ask you to choose a base name, and a C# namespace.&lt;/p&gt;

&lt;p&gt;After few question, you will have to choose between one of the available fronts for your client. &lt;/p&gt;

&lt;p&gt;Please note that Xamarin front is only available in debug mode. That's why the &lt;code&gt;-d&lt;/code&gt; flag is mandatory.&lt;/p&gt;

&lt;p&gt;Make sure to &lt;strong&gt;choose Xamarin :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i13uUX8X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/72sub5647yo14gz7o03m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i13uUX8X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/72sub5647yo14gz7o03m.png" alt="front-choice"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Launch your back-end application
&lt;/h3&gt;

&lt;p&gt;Before talking about how to use your Xamarin front-end, run the following command to launch your server and database :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet run &lt;span class="nt"&gt;--verbosity&lt;/span&gt; normal &lt;span class="nt"&gt;--project&lt;/span&gt; ./src/YourAppName/YourAppName.csproj
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Warning: Make sure to replace &lt;code&gt;YouAppName&lt;/code&gt; with your actual real app name. &lt;/p&gt;

&lt;p&gt;Moreover, if you have any difficulty, your generated application should contains a README.md that may help you quite a bit.&lt;/p&gt;

&lt;h3&gt;
  
  
  NuGet Requirements
&lt;/h3&gt;

&lt;p&gt;Your generated Xamarin front-end application will require the following NuGet packages :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/akavache/"&gt;akavache&lt;/a&gt; &amp;gt;= 7.1.1&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/MvvmCross.Forms/"&gt;MvvmCross.Forms&lt;/a&gt; &amp;gt;= 7.1.1&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/System.ComponentModel.Annotations/"&gt;System.ComponentModel.Annotations&lt;/a&gt; &amp;gt;= 5.0.0&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/System.Net.Http.Json/"&gt;System.Net.Http.Json&lt;/a&gt; &amp;gt;= 3.2.1&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/Xamarin.Forms"&gt;Xamarin.Forms&lt;/a&gt; &amp;gt;= 4.6.0&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/Xamarin.Essentials/"&gt;Xamarin.Essential&lt;/a&gt; &amp;gt;=1.5.3&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Generated structure
&lt;/h3&gt;

&lt;p&gt;Any generated Xamarin application is structured as follows :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;client
├── Namespace.Client.Xamarin.Core     - Your core application
│   ├── Models
│   │   ├── Entities                  - Generated models
│   ├── Services
│   │   ├── Entities                  - Generated services
│   ├── ViewModels
│   │   ├── Entities                  - Generated viewmodels
│   ├── Views
│   │   ├── Entities                  - Generated views
├── Namespace.Client.Xamarin.Android  - Your Android application
│   ├── Resources          
│   │   ├── drawable                  - Contains your images
│   │   ├── Layout                    - Contains your layouts
│   ├── Properties
├── Namespace.Client.Xamarin.iOS      - Your iOS application   
│   ├── Resources                     - Contains your images
│   ├── Properties
├── Namespace.Client.Xamarin.Shared   - Shared code
│   ├── Constants                     - Contains shared constants
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Entity generation
&lt;/h3&gt;

&lt;p&gt;When creating a new entity in your database, your front-end is automatically updated to ensure a fully available management of all your entities.&lt;/p&gt;

&lt;h4&gt;
  
  
  Manual Entity Generation
&lt;/h4&gt;

&lt;p&gt;To create an entity you can run the following command in your application folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jhipster entity &amp;lt;entity-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will have to answer few more questions in order to decide if you want to add some relationship with other entities and if you want to add more fields to it.&lt;/p&gt;

&lt;h4&gt;
  
  
  JDL Entity Generation
&lt;/h4&gt;

&lt;p&gt;You can also automaticaly generate many entities tanks to a JDL with the following command :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jhipster import-jdl my_file.jdl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A JDL (JHipster Domain Language) is a JHipster-specific domain language where you can describe all your applications, deployments, entities and their relationships in a single file (or more than one) with a user-friendly syntax.&lt;/p&gt;

&lt;p&gt;You can create your JDL online on &lt;strong&gt;&lt;a href="https://start.jhipster.tech/jdl-studio/"&gt;JDL Studio&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;If you followed everything correctly, you should now have a modern Mvvm Xamarin Application with CRUD operations on all your entities.&lt;/p&gt;

&lt;p&gt;Feel free to contribute to &lt;strong&gt;&lt;a href="https://github.com/jhipster/jhipster-dotnetcore"&gt;JHipster.NET's GitHub repository&lt;/a&gt;&lt;/strong&gt; and don't forget to put a star if you liked it.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>xamarin</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
