Dealing with Conflicts in EF Core Migration

Entity Framework Core provides a lot of functionalities right out of the box, but it is not without its demerits. One of the issues that faced recently is that DbContextModelSnapshot.cs snapshot file gets when a group of developers try to merge their work upstream and it just gets all messy

I would suggest the below flow to deal with conflicts in EF Core Migration that works for my case:

1. Pull from upstream

2. If conflict exists on *DbContextModelSnapshot.cs file, abort merge

3. Revert your migration by removing it using (Remove-Migration from the console)

4. Pull from upstream

5. Resolve conflicts (from other files if any)

6. Add migration again

This flow works for us but it will be an issue with larger teams. Drop us a comment if you have other suggestions

Extracting Information from information_schema through EF Core 3.x

This is a simple documentation on how to extract the information from information_schema.columns using EF Core. I’ve tried a number of suggestions however it didn’t worked until this.

What you need

  1. New View – Create a new view in your database that selects from information_schema.columns
  2. Code Changes


protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity(mb =>

After adding the two changes, add your migration file and you would be able to map the information

Staticify your site for Performance – Part 1

Being able to serve the most users out of your shared hosting/vps is one of the most crucial component as you scale in users. For most wordpress sites (like mine), contents are mostly static without a lot of features that warrant the use of the server side framework.

Converting the site to be static html will bring a lot of changes that will open your eyes.

Static HTML sites

The good

  • Performance

Converting the site to be plain html pages will help the loading times, and request/second a big margin compared to using PHP (for wordpress sites)

  • Security

WordPress sites power more than half of the whole internet. That makes it a lucrative target for hackers to pick on. Running any server sided application exposes you to a lot of security vulnerabilities that may hit your site sooner or later. Changing the site to only serve html greatly limits the scope of attack that hackers can do.

The bad

May not fit your usecase

If your wordpress site is a dynamic page, i.e e-commerce site then having a static site wouldn’t fit your case. Having some dynamic forms would pose an issue too. However, some hybrid solutions can be implemented to serve for both cases (html for static contents, php for dynamic contents)


Setting up a static site requires maintenance and due diligence as the static site may break due to unforeseen reasons. However, this also encourages you to have another environment to test out your changes before deploying it to live which is what a moderate site should have before each change (new post, new plugin, etc).


Before we dive in into using static sites, some changes are needed to be done to prepare your site to support static html. I’ve listed some common stuffs that will require change, but do comment if you need help some other changes not listed here


Custom Google Search can be used to replace the default search bar without much changes.

Comment Form

Disqus can be used to replace the comment form, which is typically better than doing your own comment section with akismet.

Contact Form

To be done in Part 2

Tested Static Site Generators

wp2static v6 – Not the latest version but I believe the same issue occurs in the newer versions

The good

Ease of Use

Being a plugin in wordpress itself, configuring the plugin and generating the static website is pretty easy and intuitive

Multiple deployment options

From local deployment to Cloudflare workers, Netlify, BunnyCDN and more, having multiple deployment options makes life easier for technical and non-technical people to deploy their static sites to the internet

The bad

Weird Bugs

From my past experience in using it, it simply dies or still requires changes for the static site generated. From what I’ve read, v7 fixes it but it is still not stable yet so I’m refraining myself from using it for production use.

Requires maintenance

Like any other static site generators, sometimes it may generate some weird behaviour and requires some maintenance every now and then


The good

Less erratic behaviour

The command below generates the static site without much of a fuss

wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains \
--no-parent \;

The bad

No Shared hosting support

wget is not supported in shared hosting so it may not be an option for shared hosting users

Requires Maintenance

Like any other static site generators, sometimes it may generate some weird behaviour and requires some maintenance every now and then

Deployment options limited

Compared to wp2static, deploying to other platforms require manual deployment which may take more time/put some people off into using it


For now, due to the erratic behaviour of wp2static, wget is my go-to selection for now and more to be covered on Part 2 as I continue using as a static site

Audit – Database Trigger – Part 1

Audit is crucial in applications in all industries, for both compliance and troubleshooting purposes. Trigger is one of the way of implementing audit by logging the information on the database level rather than application level which is the trend moving forward now.

There are multiple ways to implement audit using trigger, but today we will be talking about the method where old value and new value is logged which is a fairly standard implementation.

Typically a stored procedure is used to generate the DDL Trigger for each table to be logged. During the implementation of the stored procedure, you will need to map each column value into the audit table. While using a nvarchar field could work, but personally I’d prefer having the native datatype to be used in the insertion for less headache of something changed or behaving weird.

To generate the datatype of each of the columns, you can use the below scalar function to generate the datatype based on information from information_schema.columns.

The SQL below is built for SQL Server, so you will need some changes if you’re to implement it in a different RDBMS


More on the implementation will be discussed on Part 2 of this sharing.

Automated System Email – Redefined

From user registration, user confirmation, order confirmation, payment Confirmation, automated system email is crucial to your application.

There are multiple ways of implementing it in your application and I’ll go through the options and the way I prefer.

Single To

The Good

It’s simple. Easy to implement.

The Bad

Email replies may go to blackhole if you didn’t have anything setup depending on the provider. Providers like mailgun requires you to enable the incoming email setting first before being able to receive one.

Charges is also another thing to look into. Providers like Mailgun and Amazon SES charges for every incoming email received, so even if you have it enabled, the cost of receiving the email through your automated system email address can be very costly

Multiple Tos/Single To, Single CC

Multiple To case, support email is included in To section
Single To, Single CC case, support email is included in CC section

The Good

It’s simple. Easy to implement.

The Bad

In the case of using Gmail, when you press Reply, you’re only replying back to the automated system email address instead of support, you will need to press Reply All in order to reply to support email as well. But the downside still is from the UX standpoint, the user is replying to the automated system email address which may cause confusion. the same goes for Single To, Single CC/BCC

Introducing Reply-To

In Reply-To case, support email is in reply-to section

The Good

From a UX standpoint, it provides a smooth transition from automated system email to an actual person/team (in this case support), because when you click Reply/Reply All in Gmail, you’re only sending email to the support rather than to both support and the automated system email address

The Bad

  • Probably need some code changes for it


From a UX standpoint, it is better to implement Reply-To in your automated email workflow.

Did I miss out anything or said something wrong? Drop me a comment at the comment section below.

Developer Job Search during Covid19 Pandemic

Are you affected by the wave of covid-19 pandemic?

With covid-19 hitting the shores, my country on lockdown two weeks after my resignation and the black swan event that crashed the stock market, effectively killing the market in half for many companies and industries, it has been quite a hell of a ride as many companies have decided to freeze their hiring, leaving yours truly in a standstill.

I would like to share my tips & thoughts on job search during this pandemic.

1 – Prep Resume & Apply until the guy next door knows it

Prepare your resume and apply NOW. LIKE RIGHT NOW. You are forgiven to not continue reading this post until you have done the above.

Do not have a resume in hand? Update your LinkedIn profile and use the generated resume as your temporary resume while you write your own one.

Companies take 1-4 weeks to reply and you would be spending your worth of time applying for a job first before continue reading.

2 – Recruiters

Recruiters can be your best or worst friend. A good recruiter can lead you to new opportunities that are typically not found on the job searching websites while a bad recruiter simply just shoves whatever available to your mouth and demeaning you.

Engaging with a recruiter does benefit the newer guys in the market as tips & tricks will be shared on how to score your interview. On the other hand

However, always question yourself internally on everything from the lips of a recruiter as there is a conflict of interest, especially when you are engaging with multiple recruiters.

3 – Position yourself

As someone who have been working for many years, positioning yourself would probably be a second nature but could still be a challenge for someone who is still new in the workforce.

While you could always change your technology stack, but you could face resistance as you grow to be more senior as typically companies want to find the best fit.

4 – Understand the Company and Industry

Not understanding the company and industry could land you another retrenchment as you join the company as companies typically go by LIFO (last in first out). Heavily affected companies such as Airbnb, Agoda have been laying off staffs left and right and you definitely do not want to get caught in that industry for now as a newcomer until the situation recovers.

Go for industries like Glove, Logistics, iGaming n etc that have been on the fly as they are the winners in this round of pandemic.

Choose wisely (you have been warned).

5 – Documentation

Start thinking back on the unique issues, custom logic, or any interesting stuff that you have built/solved/encountered back then and start to document all these down. It may take a while and you may not be able to recall everything, so hop on and have a chat with your ex-colleagues to chat about this and have some social interaction while documenting.

The document will serve as your base to tackle what are the interesting stuffs that you encountered and how do you solved it, or what are the worst bug that you’ve faced and how did you solved it type of questions. You will be able to answer confidently rather than stuck on err, ahh, hmm for a prolonged period and watch your interview gets deducted one by one.

Do continue documenting even after you’ve landed on a job because you don’t need when will you need it again.

6 – Coding Interview tests sucks

Red Black Tree? Quick Sort? Binary Search? Coding tests suck as it is not an indicative indicator of a day to day programmer’s job. Using the framework/library is better rather than reinventing the wheel and breaking a leg or two in the process.

Meaningless to say, pulling out the implementation of a binary search from the back of my mind, writing the code and explaining it with confidence within 10 minutes of being asked is probably not a lot of person’s forte.

Regardless of my rant, coding test is here to stay and I find /r/dailyprogrammerto be a nice place to train your skills to train and you may even see the same questions appearing in your interview test (sounds like a school test but in reality its true).

I typically enjoy interview test that emphasizes on writing unit test (yes, many companies still don’t care about testing), code structure, design patterns, refactoring strategies and there is something to bring home from the above discussion.

Kudos to Fave for hosting an awesome interview although I didn’t managed to land on the job due to the current situation.

7 – Trust your gut

If you feel bad about the company, the interview, the hiring manager, the industry or anything along the line, DO NOT GO FOR IT.

Yes, this is contrary to what I’ve mentioned to just apply apply and apply, but if you do not feel good about the company say after reading reviews on Glassdoor or the hiring manager said stuffs that triggered you, then it is most probably a good idea not to go for it as you are not fit for it.

Searching for a job is important but staying sane after getting a job is equally important too.

The Future?

Times are tough with the given economic situation and pandemic. But I too see this as a opportunity for many to start afresh, to treat it as a new beginning, or to seek new opportunities from the current situation. Wherever you are, times will past and just as our parents and our great great grandparents did, we will ride through it, definitely.