Skip to main content

Posts

Showing posts from June, 2017

Dynamic Assembly in C#

Static Assembly Vs Dynamic Assembly Static Assemblies are those assemblies which are stored on the disk permanently as a file or set of files. Since these assemblies are stored in the disk, those are only loaded when CLR requests.  These are the assemblies we are dealing with daily. Assemblies that I'm going to talk about today bit different. It completely opposite of the Static Assemblies. Those Assemblies are not stored on the disk before execution. When an application requires any type, which references from these assemblies, DOT NET will create these Assemblies at the runtime so that it will directly load into the memory. Why is it important ? Like I mentioned, this is not something we do very often. It is not all about how important it is. Personally, I think it is better to know this kind of hidden language features. More you play with this more you learn. I found cool stuff I can do with this. Hope it will be same for you as well. This is an old feature. How ...

Getting started with AutoMapper

DTO DTO stands for Data Transfer Object. DTOs are there for transfer data between the different application or different layers within a single application. You can look at them as dump bags of information. The purpose of existence is just getting that information to a recipient. So that recipient doesn't get anything other than they expect. The major problem that I had with this DTO is mapping one object to another. Every place where I need to transfer my data using DTO, either I have to use parameterized constructor or new object initialize to inject the information (data) into it. Recently I found this library called AutoMapper  which made my code awesome. AutoMapper is a simple little library built to solve a deceptively complex problem "getting rid of code that mapped one object to another" . AutoMapper It all started with Source Object and Destination Object to work with (well, that's obvious!). This works best as long as the names of the source ty...