A series of best practices are used to design the entire enterprise database. The following are some best practices:
- The common module is used in the core library.
- Unified naming conventions and versions are used.
- Use unit tests during design
- Include infrastructure in all modules
The Enterprise Library module includes the following models, including other models:
- Factory mode: One creation mode. You can use the specified type to create another object.
- Plug-in mode, which extends the class behavior. Create a subclass in a special environment that only contains the required functions.
- Dependency injection mode. In this mode, you can inject objects into the class instead of creating objects in the dependent class.
I. Factory Model
The factory mode is a creation mode in the software design mode. The factory model is widely used in the enterprise database. For example, in the caching module, cachefactory initializes an instance of a cachemanger object. cachemanager creates a cachemanagerfactory object and then creates a cache object. Cache is a copy of the back-end data in the memory. After a cache object is created, the application can use the cachemanager object to obtain data in the cache, add data to the cache, and remove the object from the cache. For more information, see cache module.
The data access module uses the factory mode in a similar way. The client code calls the static method createdatabase of databasefactory to create the database object instance. For more information, see the data access module.
Ii. Plug-in Mode
Plug-in mode is a software mode that creates an object or an interface instance during running. The plug-in mode extends the behavior of existing code so that it can achieve more purposes. Unlike the use of class inheritance, class inheritance can modify or override the behavior, and the modification of the behavior of the plug-in mode is limited.
In the plug-in mode, the modified behavior (plug-ins) is connected to a distributed partial class, which is in turn connected to the core class. The plug-in uses this interface to implement the method called by the core class, and can also call the new method of the core class.
Iii. Dependency injection mode
The dependency injection mode allows you to inject objects into the class, instead of relying on this class to create objects. This is very helpful in the following situations. When you want to decouple the special implementation or deployment details of your application. The dependency injection mode decoupling service or other code may be stored in the container. Then, process the code dependency responsibilities, including object creation and connection, remove from the object itself, and transfer to other entities. Unlike the factory mode, the dependency injection mode is used, and the code in the container is shared by multiple applications.
In the system. componentmodel namespace, It is a Microsoft implementation of the dependency injection mode. In the Enterprise Library, the objectbuilder and unity modules can be used to implement the dependency injection mode.
Not complete ............................
Http://www.cnblogs.com/virusswb/archive/2010/04/18/1714810.html