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 



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!


Tags: Design Pattern C#

comments powered by Disqus