Category: Uncategorized

RSGC – DTO Mapper – part 6

 

 

name GeneratedMapper
nuget

https://www.nuget.org/packages/GeneratedMapper/

link https://github.com/ThomasBleijendaal/GeneratedMapper
author Thomas Bleijendaal

AutoMapping from a POCO to a DTO. Lots of customizations
 

The code that you start with is


    public class Department                                    

        {

            public int ID { get; set; }

            public string Name { get; set; }

            

            public List<string> Employees { get; set; }

        }

    

        [IgnoreInTarget("Employees")]

        [MapFrom(typeof(Department))]

        public class DepartmentDTO

        {

            public int ID { get; set; }

            public string Name{get; set;}

    

            [MapWith("Employees",typeof(ResolverLength))]

            public int EmployeesNr { get; set; }

    

        }

        public class ResolverLength

        {

            public int Resolve(List<string> input)

            {

                return ((input?.Count) ?? 0);

            }

        }


The code that you will use is



    static void Main(string[] args)                                

    {

        var dep = new Department();

        dep.Name = "IT";

        dep.ID = 1;

        dep.Employees = new List<string>();

        dep.Employees.Add("Andrei");

        var dto = dep.MapToDepartmentDTO();

        Console.WriteLine(dto.Name+"=>"+ dto.EmployeesNr);

    }

 

The code that is generated is


    namespace DTOMapper                                                                                                                                                                                                        

    {

        public static partial class DepartmentMapToExtensions

        {

            public static DTOMapper.DepartmentDTO MapToDepartmentDTO(this DTOMapper.Department self)

            {

                if (self is null)

                {

                    throw new ArgumentNullException(nameof(self), "DTOMapper.Department -> DTOMapper.DepartmentDTO: Source is null.");

                }

                

                var resolverLength = new DTOMapper.ResolverLength();

                

                var target = new DTOMapper.DepartmentDTO

                {

                    ID = self.ID,

                    Name = (self.Name ?? throw new GeneratedMapper.Exceptions.PropertyNullException("DTOMapper.Department -> DTOMapper.DepartmentDTO: Property Name is null.")),

                    EmployeesNr = resolverLength.Resolve((self.Employees ?? throw new GeneratedMapper.Exceptions.PropertyNullException("DTOMapper.Department -> DTOMapper.DepartmentDTO: Property Employees is null."))),

                };

                

                return target;

            }

        }

    }

    

Example Code: https://github.com/ignatandrei/RSCG_Examples/tree/main/DTOMapper

All RSCG

NrBlog Post
1RSCG–part 1
2RSCG- AppVersion–part 2
3http://msprogrammer.serviciipeweb.ro/2021/02/17/rsgc-enum-part-3/
4RSGC-JSON to Class- part 4
5RSGC-Constructor – Deconstructor – part 5
6RSGC – DTO Mapper – part 6
7RSGC – Skinny Controllers- part 7
8RSGC-Builder Design Pattern – part 8
9RSGC- MetadataFromObject – part 9
10RSGC- Dynamic Mock – part 10
11RSCG- Method Decorator – part 11
12RSCG – Curry – Partial function – part 12
13RSCG- part 13 – IFormattable
14RSCG- part 14 – DP_Decorator
15RSCG- part 15 – Expression Generator
16RSCG- part 16 – Many Others
17RSCG- the book
18RSCG–Template Rendering- part 17
19CI Version
20HttpClientGenerator
21Query from database
22AutoRegister
23TinyTypes
24Static2Interface
25AppSettings
26Properties
27
Roslyn Source Code Generators

Crash Course on .NET Core 5.0

Who is addressed to

This tutorial is aimed to C# programmers with at least 6 months experience. Also , they should  have at least 6 months experience with HTML / CSS / Javascript .. This will help them to understand  .NET Core 3 and how to build applications with the .NET Core framework

The class will be taken by Andrei Ignat, C# MVP for 6 years, https://forums.asp.net moderator and OpenSource contributor( you can find his AspNetCoreImageTagHelper mentioned on https://github.com/aspnet/Mvc ). More details at his blog at http://msprogrammer.serviciipeweb.ro .

 

What it contains

Day 1

  1. .NET Core, .NET Standard, .NET Framework
  2. Some C# advanced
  3. C# 7-8 what’s new
  4. .NET Core 3 what’s new

Day 2

  1. .NET Core WEBAPI / MVC
  2. .NET Core backend – BL, DAL, Security, tests
  3. EF – console, ASP.NET Scaffolding
  4. Functional Anatomy of ASP.NET Core
  5. Ecosystem
  6. .NET Core MVC/ WebAPI – demo and exercises

Day 3

  1. C# 9 What’s new
  2. ASP.NET Core 5
  3. Roslyn Code Generators
  4. EF Core 5
  5. Breaking Changes
  6. Practical Exercise with WebAPI / MVC

Crash Course on Angular

Who is addressed to

This tutorial is aimed to HTML/Javascript/CSS programmers with at least 6 months experience. This will help them to build application with Angular.

The class will be taken by Andrei Ignat, C# MVP for 6 years, https://forums.asp.net moderator and OpenSource contributor( you can find his AspNetCoreImageTagHelper mentioned on https://github.com/aspnet/Mvc ). More details at his blog at http://msprogrammer.serviciipeweb.ro .

What it contains

Day 1 – start Angular

You will learn the basics of Angular ( Components , Observables, TypeScript )

We will make together the code of Tour of Heroes Application –  official Angular application.

You will be helped if need arises with the code , questions and more.

 

Day 2  – Angular advanced

Observables , marbles and RxJS

Http Interceptors

Passing data via components – services

GUI – Pipes, Forms,

Saving/Reading  data to/from backend -with .NET Core

Deploy – environments

 

Crash Course on .NET Core 3.0

Who is addressed to

This tutorial is aimed to C# programmers with at least 6 months experience. Also , they should  have at least 6 months experience with HTML / CSS / Javascript .. This will help them to understand  .NET Core 3 and how to build applications with the .NET Core framework

The class will be taken by Andrei Ignat, former C# MVP for 6 years, https://forums.asp.net moderator and OpenSource contributor( you can find his AspNetCoreImageTagHelper mentioned on https://github.com/aspnet/Mvc ). More details at his blog at http://msprogrammer.serviciipeweb.ro .

What it contains

Day 1

  1. .NET Core, .NET Standard, .NET Framework
  2. Some C# advanced
  3. C# 8-9 what’s new
  4. .NET Core 3 what’s new
  5. .NET Core backend – BL, DAL, Security, tests
  6. EF – console, ASP.NET Scaffolding
  7. ASP.NET Core – Heads up

 

Day 2

  1. Demo Why DI
  2. Anatomy of ASP.NET Core
  3. Plugin Architecture
  4. Winform / windows service / webapi
  5. Arhitectura html+webapi demo

 

DOTNET DAYS -NEXT YEAR

Hi!

 

We are delighted to invite you to share our passion for technology at the second edition of the dotnetdays conference that will take place on 29 February 2020. 

 

About dotnetdays 

 

Dotnetdays is a .NET event driven by a great passion for technology and the .NET community.

 

The second edition will take place on 29 February 2020 at the International Hotel in Iasi, Romania. This year we’re excited to have some great speakers that are present at major conferences in Europe and the USA (most of them are for the first time in Romania), such as:

  • Jon Galloway – Executive Director – .NET Foundation
  • Alex Mang – Microsoft MVP & Regional Director, Microsoft Ignite Speaker
  • Alex Thissen – Microsoft MVP & Cloud Architect
  • Dennis Doomen  – FluentAssertions author (more than 30 million NuGet downloads)
  • Dennis van der Stelt – distributed system guru and part of NServiceBus team, will do 2 days workshop on SOA
  • Jimmy Bogard – AutoMapper and MediatR author
  • Martin Beeby – Principal Developer Evangelist @Amazon

And that’s not all. More speakers and workshops will be announced soon.

We will host 4 days of intensive technical talks and workshops. The schedule is yet to be finalized, but you get a peek at what’s about to come: 

  • 2 days of intensive workshops
  • 1 full-day of free workshops delivered by wonderful people in the community  
  • 1 full-day conference

 

Until the 9th of January, you can also purchase tickets at Regular price. Get yours here.

 

Looking forward to your answer,

The dotnetdays team 

 

Stay tuned and follow us on Facebook, Website,Twitter

My Tools in 2018

Next time I will make the tools better, for having the URL next to them. For the moment, you can google/bing/duck them .

However, those are the most used tools by me in 2018:

  1. Utilities

    1. Browsers
      • Firefox
      • Edge
      • IE
      • Chrome
    2. RemoteViewers
      • TeamViewer
      • RemoteDesktop
    3. angular-cli-ghpages – npm
    4. glogg
    5. Abiro PhoneGap Image Generator
  2. IDE / Editors

    1. Visual Studio Code
    2. Visual Studio 2017
    3. SSMS for SqlServer
    4. Notepad++
  3. Misc

    1. Organizer
      • rescue time
      • Cronofy for trello -sync with google calendar
      • Trello – major projects
      • Todoist – shopping list
    2. Sites
      • http://www.picturetopeople.org/text_generator/others/transparent/transparent-text-generator.html
      • wikipedia
      • http://www.webgraphviz.com/ – display dot languge
      • Linkedin – CV
    3. Communications
      • meetup.com
      • facebook
      • Outlook
      • Slack
      • Gmail – email
      • Yahoo – email
      • Skype
    4. Decompiler – IlSpy – https://github.com/icsharpcode/ILSpy/releases
    5. Presentations
      • https://remarkjs.com
  4. Hardware

    1. Surface PC
    2. Android Phone
  5. Development

    1. Office Addins
      • Outlook vba alerts
      • https://docs.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-quickstart-angular
      • https://github.com/OfficeDev/generator-office
      • https://github.com/OfficeDev/Word-Add-in-Angular2-StyleChecker/blob/master/app/main.ts
    2. ChromeAddons
      • Export for Trello
      • OneTab
      • Todoist
    3. Angular components
      • office-addin-validator
      • @angular/material
    4. Javascript components
      • https://mermaidjs.github.io
      • https://github.com/adrai/flowchart.js
      • https://appsforoffice.microsoft.com/lib/1/hosted/office.js
    5. .NET Packages
      • simpleinjector
      • ScriptCs.Octokit
        https://github.com/alfhenrik/ScriptCs.OctoKit
      • Octokit
        https://github.com/octokit/octokit.net
      • dotnet tool install -g DotnetThx
      • Razor interpreter : https://github.com/toddams/RazorLight
        https://www.nuget.org/packages/RazorLight/
      • dotnet gcr
      • dotnet aop
      • Roslyn
      • https://github.com/crozone/FormatWith
      • xunit
      • Newtonsoft.json
      • RestSharp
      • MediatR
      • https://fluentassertions.com/examples/
      • https://github.com/shouldly/shouldly
      • swagger
      • Microsoft.Exchange.WebServices
    6. continous integration
      • Jenkins
      • https://github.com
      • https://www.bitrise.io/
      • https://ignatandrei.visualstudio.com/
      • https://codecov.io
      • https://ci.appveyor.com
    7. Frameworks
      • Angular
      • Cordova
      • .NET Core
    8. typescript paste extension visual studio
    9. Docker
      • Portainer
  6. Newsletters

    1. Code project
    2. Asp.net weekly
    3. R Weekly
    4. Code project
    5. DNK Daily
    6. JSCRipt daily
    7. JavaScript Weekly

For 2019, the list is public at https://trello.com/b/3O1fFpcl/tools2019

Detailed list about my activities in programming in 2018

This is what I have done in 2018:

Base learning

  • Angular
  • R
  • CI /CD with Azure DevOps Syntax base
  • Roslyn
  • .NET Core

 

Presentations:

  • Continuing the presentations about Design Patterns ( course )
  • Various Presentations ( ROSLYN AOP, Introduction to R, Messaging with MediatR)
  • Presenting at OWASP : Top 10 OWASP and counter attacks in .NET Core
  • Presenting at Code Camp Bucuresti .NET Core and Angular – deploy on Windows, Android, Linux ( Mac + iOS) : https://github.com/ignatandrei/AngNetCoreDemo

 

 

Free Projects :

             

  • Literary Awards – full javascript, database in the browser

Site Web: https://ignatandrei.github.io/LiteraryAwards/

Android :https://play.google.com/store/apps/details?id=com.msprogrammer.com

 

  • ONG Declaration for Romania

GitHub : https://ignatandrei.github.io/Decl230/

Android: https://play.google.com/store/apps/details?id=decl203.msprogrammer.ro

 

Starting Stankins v2  : https://github.com/ignatandrei/stankins , Live Demo at https://azurestankins.azurewebsites.net

 

 

Components:

  • AOP_With_Roslyn – .NET Global Tool for AOP with ROSLYN

GitHub :https://github.com/ignatandrei/AOP_With_Roslyn

NuGet: https://www.nuget.org/packages/dotnet-aop

 

  • AspNetCoreImageTagHelper – .NET Core for base 64 images

GitHub: https://github.com/ignatandrei/AspNetCoreImageTagHelper

NuGet: https://www.nuget.org/packages/AspNetCore.Mvc.ImageBase64/

Mentioned on https://github.com/aspnet/Mvc

  • Versions For .NET Core written in Angular:

NPM  : https://www.npmjs.com/package/versions-netcore-angular

Live Demo: https://azurestankins.azurewebsites.net/about

 

Books:

( free download at http://msprogrammer.serviciipeweb.ro/2018/09/03/making-open-source-component-from-idea-to-deploy-with-examples-from-net-core/ )

 

Various:

 

 

 

Several DesignPatterns and Introduction to R

On Tuesday I will make 2 presentations :

1. Several Design Patterns in .NET Framework
We will pass to Prototype ,Iterator ,Builder, Adapter,NullObject and we will show their use in .NET Framework
2. Introduction in R
How to get started, what can do , small application and how to run on Azure.

The link is https://www.meetup.com/Bucharest-A-D-C-E-S-Meetup/events/247801047/ .

For more design pattens, please see http://msprogrammer.serviciipeweb.ro/2018/03/05/design-patterns-class/

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.