BuyMeACoffee

Buy Me A Coffee
Mostrando las entradas con la etiqueta .NET Core. Mostrar todas las entradas
Mostrando las entradas con la etiqueta .NET Core. Mostrar todas las entradas

domingo, 13 de junio de 2021

How To Prepare for MAUI Blazor in Microsoft .NET 6


Prepare For MAUI Blazor in the next evolution of Xamarin Forms & .NET Core: .NET 6 MAUI

MAUI is the evolution of Xamarin Forms, and it a now allows you to combine it with Blazor to make great cross platform systems in no time, allowing you to reutilize your components as much as possible, and have consistent layouts across the different platform specific builds for your system.

MAUI Blazor is great, though, you need to have some special considerations, one of those being that not all of your Blazor WebAssembly logic will be able to be reutilized so simply.

Those issue however, have solutions.

You need to take advantage of Blazor component-based design, and make sure that most of the pieces you want to reutilize in your MAUI Blazor app, are designed as independent components, it is also better if those components only receive the data.

In situations where you need to use Azure Ad B2C, you to do so, in the same way you would do outside of the Blazor Webview, and instead do so in the same way you would do it for Xamarin.Forms applications, after all, remember that MAUI is the next evolution of Xamarin, and MAUI Blazor is Blazor on top of MAUI.


Check the following videos to learn what you need to be prepare for MAUI Blazor.





viernes, 19 de marzo de 2021

Why you must move to Blazor



If your business develops applications on .NET, you probably have already heard of Blazor.

Blazor is a framework for building interactive client-side Web UIs with .NET, 
a dream come true, not only for .NET Developers, but also for companies who want to optimize their development speed, while maintaining high quality standards, avoid code duplication, and reuse existent code in both server-side and client-side.

Blazor allows you to create rich interactive UIs using C#, reducing and even eliminating
your need to create Javascript code.

Blazor allows you to share your logic written in .NET between server and client-side, e.g. a custom regex validation that needs to be performed in front-end and in back-end, well, with Blazor, you can reuse the actual validation classes between client-side and server-side, effectively implementing the validation only once.

Blazor allows you to utilize a lot of already existent .NET libraries, on your client-side!

Another great feature of Blazor, is that Blazor apps are based on components, which in Blazor are elements of UI such as a page, dialog or data entry, and since they are implemented as components, they can be reused throughout your application, and even be shared with other applications when you create them as a Component Library.


One of the best features of Blazor, is that, due to is design, it allows you to create fully-featured, nice-looking, rich Web Applications. in no time, even as low as a day, since it removes the need of using other frameworks like in the traditional SPA ( Single Page Application ) approach depending on Angular, React, or similar.

Blazor is in fact, the perfect framework for creating MVPs ( Minimum Viable Products ) and go to market quickly, without sacrificing quality.

Since Blazor runs fully on .NET, you can even create .NET based automated test for your front-end!

Tell us, when are you moving to Blazor?

We help you move to Blazor: Hire Us here

jueves, 17 de septiembre de 2020

Introduction to PTI.Microservices.Library



Today we want to introduce you to "PTI.Microservices.Library", a NuGet package designed to aid developers create systems faster by integrating several cloud services, abstracting some of the repetitive logic, adding exception handling, an logging, while also allowing developers to have control of the configuration.

Why "PTI.Microservices.Library" was created?

At PTI Costa Rica, we do lots of Research And Development, we develop many POC (Proof of Concept) code, and many times those tasks tend to be repetitive, writing the same code.

We also like to use Strong Types and take advantage of methods such as PostAsJson, ReadFromJson, etc.

So we decided to take all that we have in our POCs, along with some of the custom code we have in our applications and convert it to a NuGet package, and share it so our customers can use it.

The package was recently released as preview, and the official documentation will be here:

https://github.com/efonsecab/PTI.Microservices.Library

Currently the package is in preview so it is free, however, the product will be accesible through a monthly subscription once it is out of preview, which should happen by the end of year 2020.


martes, 8 de septiembre de 2020

Why migrating to .NET Core, soon 5 is a must, specially after the pandemic


The COVID-19 pandemic has greatly affected companies, many being force to reduce their workforce, 
many employees have had to accept new contract arrangements with reduced salary, 
and people motivation and happiness has generally beeng reduced as well.

As result of all of this and more, companies had had to change their strategies,
many companies have had to become digital in order to survive, and since the end of the pandemic is actually unknown, companies need to reduce their expenses as much as possible, while still been agile and great in their operations.

Many companies still use old technologies, and many still are reluctant to migrate from .NET Framework to .NET Core, even if is it just for new applications.

I have worked with .NET Framework since 1.1, and with .NET Core since it's first release candidates, and I also have migrated projects across versions of each, and from .NET Framework to .NET Core.

When you develop systems with .NET Core, you actually see the difference, not only in performance, but also in development speed, which is in turn heavily linked to the time it would take for a system to be ready for go to market.

Advantages of moving to .NET Core

  • Better systems performance
  • Less overhead in systems
  • Faster communication across systems
  • Cross platform support
  • Faster software development
  • Easier development of reusable components
  • Ready for Cloud-Native applications
  • Enhanced from the lessons learned in original .NET (.NET Framework)
  • Increased range of application types you can create
  • Save you time and money
  • More innovation opportunities
Migrating not only reduces cost, while giving you an advantage over your competitors, but it is also a way to motivate your human resources, which has become even more vital after the pandemic.

domingo, 12 de mayo de 2019

6 Books Every .NET Software Developer must have

.NET Core has been growing up fast, and every day more people are taking advantage of it, while .NET Core has many similarities to .NET Framework, it has many new features and some ways to solve tasks have changed.

Below you will find a list of books which would help you polish your .NET Core Skills

Programming ASP.NET Core (Developer Reference) 1st Edition

This books is a complete guide to .NET Core and many of the features and components surrounding it.  You will learn: .NET Core, Entity Framework Core, ASP .NET Identity in .NET Core, Dependency Injection, using middleware, and more.

While most of the times not visible to the main users of a system, back-ends are a vital part of most systems. Nowadays, it is very important to have the same applications accessible from many platforms (Web, Mobile, Windows, etc), while having the same back-end, this can be easily achieved by exposing your shared functionality as Web APIs.


.NET Core 2.0 By Example: Learn to program in C# and .NET Core by building a series of practical, cross-platform projects

One of the best ways to learn is through examples. You will find a step by step guide from the installation of the required tools up to the implementation of applications running in .NET Core.



C# 7 and .NET: Designing Modern Cross-platform Applications: The Open Source revolution of .NET Core

As time passes and technologies evolve, the way to develop applications also change. Nowadays, it is required to create high-quality modern applications, which are cross-platform and many times open sourced. With this book you will learn the basis for .NET Core based moden web applications and microservices.




Enterprise Application Architecture with .NET Core: An architectural journey into the Microsoft .NET open source platform

Design and Development of Enterprise Applications is more than just coding, it is a set of steps involving methodologies, best-practices and tools to manage the systems lifecycles from its inception up to the release to production and maintenance.
With this book you will learn about DevOps, Agile, basics for enterprise level architectures, distributed computing, microservices, cloud-specific architectures, and even some market trends.



C# 7 and .NET Core 2.0 High Performance: Build highly performant, multi-threaded, and concurrent applications using C# 7 and .NET Core 2.0

Modern applications require to respond very quickly and efficiently, though also many times these systems have the need to perform long-running tasks, which, if not designed correctly, can create bottlenecks and heavily reduce the system performance. With this book, you will learn to design and implement highly performance systems by using such as multithreading and microservices.



domingo, 25 de noviembre de 2018

How to set row creation info for your Entity Framework Core entities



There are many time where we need to have tracking where our data rows were originated from,
let's say we need this information:

  • Creation Date & Time
  • Source Application
  • Source Application IP Address
  • Originator User

Depending on how big our system is, and how good or bad it is designed, it could be a real pain to send this information, specially if our system is a set of multiple applications.
So, what we could do?

When using Entity Framework Core, we can take the advantage of it using Code First and Partial Classes, so what we can do is the following

  1. Create and interface with the columns representing the Source Information
  2. Create a Partial class for each Entity which requires the Origin information and make it implement the previously created interface.
  3. Create a Partial class for our DbContext
  4. Create a custom Validation method which would check if the entity uses the interface, and if the fields are not assigned, set them a value
  5. In the partial class override the Save methods, and invoke the previously created validation method

Sample code:

public partial class MainContext : DbContext
    {
        protected string ConnectionString { get; set; }
        public MainContext(string connectionString)
        {
            this.ConnectionString = connectionString;
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                optionsBuilder.UseSqlServer(ConnectionString);
            }
        }

        public override int SaveChanges()
        {
            ValidateAndSetDefaults();
            return base.SaveChanges();
        }

        public override int SaveChanges(bool acceptAllChangesOnSuccess)
        {
            ValidateAndSetDefaults();
            return base.SaveChanges(acceptAllChangesOnSuccess);
        }

        public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default(CancellationToken))
        {
            ValidateAndSetDefaults();
            return base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken);
        }

        public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            ValidateAndSetDefaults();
            return base.SaveChangesAsync(cancellationToken);
        }

        private void ValidateAndSetDefaults()
        {
            //Check https://www.bricelam.net/2016/12/13/validation-in-efcore.html
            var entities = from e in ChangeTracker.Entries()
                           where e.State == EntityState.Added
                               || e.State == EntityState.Modified
                           select e.Entity;
            foreach (var entity in entities)
            {
                if (entity is IOriginatorInfo)
                {
                    IOriginatorInfo entityWithOriginator = entity as IOriginatorInfo;
                    if (String.IsNullOrWhiteSpace(entityWithOriginator.SourceApplication))
                    {
                        entityWithOriginator.SourceApplication = System.Reflection.Assembly.GetEntryAssembly().FullName;
                    }
                    if (String.IsNullOrWhiteSpace(entityWithOriginator.OriginatorIpaddress))
                    {
                        entityWithOriginator.OriginatorIpaddress = String.Join(",",
                            PTI.NetCore.CommonUtilities.NetworkUtilities.GetCurrentHostIPv4Addresses());
                    }
                    if (entityWithOriginator.RowCreationDateTime == DateTimeOffset.MinValue)
                    {
                        entityWithOriginator.RowCreationDateTime = DateTimeOffset.UtcNow;
                    }
                    if (String.IsNullOrWhiteSpace(entityWithOriginator.RowCreationUser))
                    {
                        try
                        {
                            entityWithOriginator.RowCreationUser = System.Threading.Thread.CurrentPrincipal.Identity.Name;
                        }
                        catch (Exception)
                        {

                        }
                    }
                }
                var validationContext = new ValidationContext(entity);
                Validator.ValidateObject(
                    entity,
                    validationContext,
                    validateAllProperties: true);
            }
        }
    }