.NET Core 2.0 With Angular 4 and MySQL, Part 4: Repository Pattern

With the Repository pattern, we can create an abstraction layer between the data access and the business logic layer of an application. By using it, we are promoting a more loosely coupled approach to access our data from the database. Also, the code is cleaner and easier to maintain and reuse. Data access logic is in a separate class, or sets of classes called a repository, with the responsibility of persisting the application’s business model.
Implementing the repository pattern is our topic for this post.

Link: https://dzone.com/articles/net-core-20-with-angular-4-and-mysql-part-4-reposi

Ref Returns and Ref Locals in C# 7.0

C# 7.0 introduces ref returns and ref locals. The main goal of these new features is to make it easier for developers to pass around references to value types instead of copies of their values. This is important when working with large data structures that are implemented as value types. This blog post shows how to use ref returns and ref locals in C#.
Current Ref and Out Arguments
We can use ref and out arguments to send some variables to the method and let it modify the value of this method. This way we can write methods that “return” more than one value. Ref lets the value type in by reference. Out means that the variable will get a value in the method where it is given as an argument.

Link: https://dzone.com/articles/ref-returns-and-ref-locals-in-c-70?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

How to Create Dynamic Strings In C#

As we all know, strings are immutable, because, after a string is stored in the memory, the memory, which is allocated for the string, cannot change.
If the string changed, a new memory location is needed to store the changed string. In these circumstances, we use the StringBuilder class with a string type.

Link: https://dzone.com/articles/how-to-create-dynamic-strings-in-c?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

The State of C# – What Have I Missed? [Video]

One of the most popular programming languages on the market is getting even better. With every iteration of C#, we get more and more features that are meant to make our lives as developers a lot easier. Support for writing (hopefully) better and more readable asynchronous code, being able to do pattern matching, tuples, deconstruction, and much more. These are just a few of the many additions to C# that we’ve seen lately. In this talk, I go through how C# has changed, as well as focusing on what’s coming in C# 7.1, 7.2, 8.0, and beyond!

Link: https://dzone.com/articles/the-state-of-c-what-have-i-missed-video?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Aspect Oriented Programming in C# using DispatchProxy

Aspect Oriented Programming (AOP) is a very powerful approach to avoid boilerplate code and archive better modularity. The main idea is to add behavior (advice) to the existing code without making any changes in the code itself. AOP provides a way of weaving an aspect into the code. An aspect is supposed to be generic so it can be applied to any object and an object should not have to know anything about advice. AOP allows the developer to separate cross-cutting concerns and makes it easier to follow the Single Responsibility Principle (one of the SOLID principles). Logging, security, transactions, and exception handling are the most common examples of using AOP. If you are not familiar with this programming technique you can read this or this. Don’t be scared if you still do not understand what it’s all about. After looking at several examples, it becomes much easier to understand.
In Java, AOP is implemented in the AspectJ and Spring frameworks. There are PostSharp (not free), NConcern, and some other frameworks (not very popular or easy to use) to do almost the same stuff in.NET.

Link: https://dzone.com/articles/aspect-oriented-programming-in-c-using-dispatchpro?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev