BLAZOR: Building client side web apps in C#.NET

There is a good news for all C# developers which love to develop web applications but don’t like JavaScript. Microsoft has come up with new client side development framework which enables us to write C# code on client side instead of JavaScript.

Reusable web UI component can also be created using C#, HTML and CSS. This mean client and server both are written in C# which can share libraries and code. This makes code size small and easy to maintain. Keep on reading

AutoMapper ignore attributes from mapping

This is an informative post because I was not able to find this information with above title and most of the time we try to search with this title phrase only.

When you are using AutoMapper and want to ignore some fields from the mapping then there is a simple solution provide from Automapper version 5.0 and later. Keep on reading

Disable automatic table creation in Entity Framework

Usually I prefer code first approach which in turn leads to create or update database based on the any change that I do in my entity model classes. This is very straight forward.

But in one of my recent project for and enterprise client they asked not to do any change in database from code as database should be maintained by the DBA team only so I have to disable database creation and upgrade from my code. To do that I simply have to update one line in my code that is Database.SetInitializer. Keep on reading

Debug multiple projects from one Visual Studio solution

When we try to troubleshoot issue in visual studio project having website and web service project both or may be troubleshooting different layers of visual studio project in solution we need to debug in multiple project.

Multiple project debugging is very simple but only difficulty is that Visual Studio keep is off by default. You can enable multiple project debugging with below simple steps in your solution. Keep on reading

Password hash using PBKDF2 with HMAC SHA256/ SHA512 in .NET Framework 4.7.2 and .NET Core 2.0

Here I am back with more updates on PBKDF2 with HMAC but this time I am talking about SHA-2 family of hashes which includes SHA-256 and SHA-512, both that to in standard .NET framework.

I have posted another article for implementing PBKDF2 with SHA-2 family for password hashing which has custom implementation of PBKDF2 as at that time this option was not available in standard .NET framework. Keep on reading

AutoMapper configuration in older and newer versions

Recently when I was looking for various architecture approached and tools sets, I saw this post which is very useful. But while I was going through the post I was getting error while implementing AutoMapper. I started getting below errors when I tried to configure AutoMapper as given on the link.

  • The type or namespace name ‘Profile’ could not be found (are you missing a using directive or an assembly reference?)
  • ‘ViewModelToDomainMappingProfile.ProfileName’: no suitable method found to override
  • ‘ViewModelToDomainMappingProfile.Configure()’: no suitable method found to override
  • ‘DomainToViewModelMappingProfile.Configure()’: no suitable method found to override
  • ‘Mapper’ does not contain a definition for ‘CreateMap’
  • ‘Mapper’ does not contain a definition for ‘CreateMap’

After some time I figured out the problem. Actually while following the tutorials I installed latest version (7.0.1 at that time) of AutoMapper from nuget while this tutorial was using 3.3.1 (that article was written sometime in 2015). Keep on reading

Javascript : Change current URL without redirecting the page

Sometimes, we need to change the url of current page without redirecting the page to the another url. Using javascript , we can achieve this very easily.

We can use the location object and its different properties to create our new url and using window object we can easily replace the current url with the new one.

Here is the example using which we can perform it :

<scrript type=”text/javascript”>

var clean_uri = location.protocol + “//” + location.host + location.pathname;

window.history.replaceState({}, document.title, clean_uri);

</script>

Thus, using above two line of code, we can change the url of any page without refreshing or redirecting it.