Ehsan Ghanbari

Experience, DotNet, Solutions

Does it cause any kind of performance issue using a base class in Layer SuperType pattern?

I had a long discussion with one of my colleague about using a base class in Data access layer or repository instead of implementing all common scenario like CRUD operation for every aggregate. it's Layer SuperType pattern that I'm talking about. I've posted about Layer SuperType pattern before, but now I'm going to know that what will happen in an application with large amounts of requests and transactions to performance in the case of using base class for Common methods of DAL.

This this the answer of Scott Millet on Twitter for my question, here is the discussion 

 

          LayerSupertype

As you can see in the stackoverflow link suggested by scott here, when you inherit from a base class and construct an object, the runtime never separate instances of the base class from inherited class. In other word, it's not like that you have two objects in memory when you have the variables of base class in inherited class. When you inherit from base class you have all variable of the base class and runs the base class constructor and also Both abstract and normal base classes act the same.  So it's not like that when you have an Insert method for a large application with lots request, you are using just the same insert to cause a performance problem!

 

About Me

Ehsan Ghanbari

Hi! my name is Ehsan. I'm a developer, passionate technologist, and fan of clean code. I'm interested in enterprise and large-scale applications architecture and design patterns. I spend a lot of time on software architecture. Since 2008, I've been as a developer for different companies and organizations and I've been focusing on Microsoft ecosystem all the time. During the past years, Read More

Post Tags
Pending Blog Posts
using Elmah in asp.net MVC4
Using FluentSecurity in MVC
Strategic design
Factory Pattern
time out pattern in ajax
Redis as a cache server
How to use PagedList In asp.net MVC
Multiple submit buttons in asp.net MVC
Domain driven design VS model driven architecture
What's the DDD-lite?
comments powered by Disqus