.NET Partial Classes vs. Inheritance -


OK, so we have a utility that generates business-model classes from our database tables and views (but Not at all at all) In maintaining an ORM, it happened to me that the data in the schema is probably not going to change a whole lot. Functionality, however, may be that we may want to add additional functionality down the road, we may want to generate some of that functionality, and we may want to expand it.

The sections we are building will reside in the class library for consumption by other libraries and applications. There is no big surprise there but the stamp here is how to design the generated sections in such a manner that we can interrupt as much as possible code while rebuilding a classroom. If, for example, the code has been added to a property (which represents a column in a database table), then we do not want to lose it. Thus, there are two ways to bring in meditation:

Classical heritage , where the whole thing is done in the same thing, the "intact" category And the consumer base implementation is free to override. It is difficult from time to time, though, and often starts painting headaches. In addition, if the derived class is not cautious and forgets to implement the performance of the base class, things can increase quickly.

Partial classes In this plan, we separate business object into different parts: property (which maps to columns), and behavioral behavior also generated below Generated behavior and custom behavior can also break down Problems with this approach, as you can see, its underlying complexity is additionally, the naming problem is

Here is my question for your people : When you If you deal with the scenario (if you have one), or if you were presented with this kind of scenario, what would you consider and why?

The entire reason for the partial classes is included. Net, code generation equipment is easy to use.

If you are preparing code, then use partial classes. It's really simple why you will be risking that the code can be reproduced from the road and you have to do a ton of work to update it again with optimization?

I do not know there is a lot of complexity - it's only a class divided into multiple files, code used in one file, custom code in another


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -