I have already been in touch with the enterprise database when I was helping the teacher with the project at the university, but I didn't understand why I used it. I just thought it was very troublesome, there are so many messy configurations (I didn't know there was a configuration tool for configuration, please forgive me ).
It was not until last year when I was working on a project and looked at the code generation tool that many of the generation tools had built-in database access to the enterprise database and some related modules that I suddenly realized, maybe the enterprise database should be a little useful, so I tried to use some modules of the enterprise database (the current version was 4.1). I think the enterprise database is still very good, microsoft encapsulates many frequently-used modules for us in the Enterprise Library, such as database access, cache, logs, exception handling, encryption, and IOC. In daily project development, the Enterprise Library runs through a module that is basically required for a project from the underlying layer to the presentation layer, which greatly facilitates our development, after all, it is better to use Microsoft to repeat the wheel itself (after all, the enterprise database is now up to 5.0)
Recently, I have been reading several of them in the garden, such as virus and huangcong. What I write now is basically my own learning path (maybe it's not as good as the first two, but just take my study notes ).
I will not talk much about it. First, I will start to learn the basic concepts of the enterprise database. Here are my notes from the enterprise database of sfbirp:
1. What is an enterprise database?
The Enterprise Library contains a series of application modules and core architectures. These highly reusable components aim to help developers solve some common enterprise development problems.
The enterprise database also provides highly configurable features, making it easier for us to manage repetitive tasks. For example, we know cross-cutting concerns that occur in many places of the application. Including logging, caching, and exception management. In addition, the dependency injection container provided by it can simplify and break down your design, make them more experimental and easy to understand, and help you create more high-performance designs and various applications.
2. Three simple steps to use the enterprise database:
1. Reference and configure the required assembly.
2. Configure the application through the enterprise database.
3. Create and use Enterprise Library objects in your code.
Iii. Benefits of the enterprise database:
The application module helps developers solve common problems from one project to another. Their design encapsulates Microsoft's recommended practices, which are based on Microsoft's framework for application development. For example, the data access application module provides the most frequently used features for ADO. NET access. In some cases, the application module also adds some basic library functions that are not directly provided.
Iv. Objectives of the enterprise database:
1. consistent. All enterprise database modules adhere to the same design mode and implementation mode.
2. scalability. All application modules include defining extensions that allow developers to customize the behavior of application modules by adding their own code.
3. ease of use. The Enterprise Library provides many practical things, including a graphical Configuration tool, simple installation process, completed documents and examples.
4. Integration. The enterprise database application module has been designed to work well together and tested in this way. But you don't have to use them together. We can use these application modules separately, and there are also some dependencies between these application modules, such as some common components in the enterprise library CORE and Unity.
The above is the basic concept of the enterprise database. After understanding the knowledge of the enterprise database, we can start to install the enterprise database.
1. Click here to go to the download page (instead of directly downloading it). You can use it after installation.
The biggest change from 5.0 to 4.1 this time is that the configuration tool uses WPF to re-build and instantiate and manage the full dependency injection Implementation of the object lifecycle. It also supports VS2008SP1 and VS2010, although the configuration tool has changed a lot this time, once you are familiar with it, you will feel better than 4.1, because you can clearly see the dependencies between each module.
Attached with relevant changes, or from the enterprise database Study Notes of sfbirp:
1. Integration of Unity and object generator
In this version, the basic technology used to create objects is a single dependency injection container, which defaults to Unity. You can use containers to generate instances of Enterprise Library objects and inject them to other objects. The enterprise database provides a standard interface to obtain instances of objects defined in the enterprise database configuration from the Unity container, such as SqlDatabase or LogWriter. in addition, the injection-friendly instance facade is effective outside the static facade because the static facade cannot be injected, but it exists to be backward compatible with previous versions. All examples in this version use dependency injection, but static factory classes and static facades used in previous versions are supported in this version. Object generator. An earlier version of the dependency injection mechanism is included in Unity in this version. You do not need to reference the object generator set separately in the project.
Supports Unity containers. You must reference a Microsoft. Practices. ServiceLocation Assembly contained in the Enterprise Library. To use a 3rd-party dependency injection container, you must directly implement the IServiceLocator interface or use an adapter.
Ii. Changes affecting all modules:
1. The main correction in the enterprise database is to use the dependency injection mechanism. The application modules and core systems used use the dependency injection mechanism and use Unity as the default dependency injection container to create and manage Enterprise Library objects.
2. The implementation of autonomous containers is completed by implementing the IServiceLocator interface provided by the Common Service Locator project.
3. Errors Caused by incorrect configuration will provide more useful error information.
4. The configuration system exposes a fluent interface for creating and filling configuration sources for a single object or the entire application. Fluent API makes it easier to create configuration sources for various scenarios.
5. The ConfigurationView class is deleted.
6. Some configuration elements have default values, which may be different from the implicit default values of previous versions.
7. The Enterprise Library now allows you to combine a hybrid configuration file using another configuration file.
8. Different configuration information can be read through different configuration files.
9. The Enterprise Library does not support the XAML browser application (XBAP ).
10. The WmiEnabled flag is ignored in 5.0 and will be deleted in the future for compatibility purposes.
11. Simplified installation allows you to install only some application modules and configuration tools.
12. For unified integration in previous versions, you must add the extension of the core enterprise Library and the extension of each module. Now, if you only need to directly access the container, only the core extension is required. A separate module is automatically supported.
The old feature is still retained to maintain its compatibility with the image, but it does not work.
13. The FileConfigurationSource. Save signature has been changed, and the number of parameters has changed from 3 to 2.
14. The Quick Start is no longer included in the main installer.
Iii. Breaking changes:
1. The enterprise library now throws a Configuration error ActivationException, which was previously System. Configuration. ConfigurationErrorsException. This includes trying to solve an instance provider with no configuration error.
2. in earlier versions, the BuildFailedException error is thrown when an application module error is obtained. Now, ActivationException is thrown for all application modules.
3. In earlier versions, when an empty source is transferred to the container to call the container, ArgumentNullException is thrown. Now NullReferenceException is thrown.
4. ObjectBuilder2 is no longer a separate assembly, but integrated into the Unity collection, and does not need to reference ObjectBuilder2.dll in the project.
5. WMI supports deletion from the Enterprise Library, except for the WMI tracking listener in the logging module.
6. if you do not close DbDataReader, it may lead to random errors that are hard to find in your code, especially when you are performing operations in an implicit transaction created by the TransactionScope context.
You must always ensure that your application closes DbDataReader in time, whether it is a clear DbDataReader. Close method to Close or force DbDataReader to release.
7. If you use the validator feature, you must reference the System. ComponentModel. DataAnnotations assembly.
8. The FileConfigurationSource. Save method signature has been changed. This method has two parameters instead of three parameters.
9. Functions of Microsoft. Practices. EnterpriseLibrary. Configuration. Design. dll collections and other Design-time collections are replaced by a new Microsoft. Practices. EnterpriseLibrary. Configuration. DesignTime. dll collection.
10. The performance counter is abnormal from PolicyInjection. CallHandlers to PolicyInjection assembly.
11. The CachingCallHandler contained in the Policy Injection Application Block has an unprocessed security vulnerability and has been removed from the Policy Injection Application Block.
Iv. Configuration tool changes:
1. The new enterprise has a new GUI library and a metadata-driven scalability model.
2. Wizard supported
3. select a new type.
4. Environmental Overrides for dependency policies is not supported. The Log Module processes Categories.
V. cache module changes:
1. cache cleanup performance optimization that has been completely overwritten
Vi. database access module:
1. The ExecuteReader, ExecuteXmlReader, ExecuteScalar, and ExecuteNonQuery methods have asynchronous versions.
2. It contains many new methods and classes that allow you to extract data as object sequences. For example, use the client query technology, such as LINQ, when appropriate.
3. The existing method ExecuteReader and the new method BeginExecuteReader do not receive the CommandBehavior parameter. These methods are called by default.
The CommandBehavior attribute is automatically set to the reder to close the connection until a transaction is specified.
VII. Exception Handling Module:
1. Log exception handling re-use the Log Writer and Trace Listeners of the Log module. This is not the default setting in earlier versions.
2. added a function to receive a default value and return a value through the predictionmanager. Process method.
After installing the Enterprise Library and learning about the 5.0 changes, I started to learn officially. The best way to learn is not to look at the source code of the Enterprise Library (I cannot understand it ), instead, download the learning example released by Microsoft
Learning example: Click here to go to the download page (not download directly)
This learning example contains the required class libraries and code demos (C # and VB.. NET), and you can right-click the App in the example. config to see how the modules in the example are configured.
At the same time, when learning the example, you can look at the example by the example (5.0 is only a re-implementation once), and combine the example with the document to see that learning is much faster:
Chinese Learning Manual: Click to download
Entlib5 program: Click here to go to the download page (not directly download ),
At this point, the first step of Entlib5's learning is over, basically, the learning examples released by Microsoft and the corresponding Chinese Learning manual can have a basic understanding of the use of 5.0.
Index of a series of articles on the learning path of Microsoft enterprise database 5.0:
Step 1: getting started
Step 2: Use the VS2010 + Data Access module to create a multi-database project
Step 3: Add exception handling to the project (record to the database using custom extension)
Step 4: Use the cache to improve the website's performance (EntLib Caching)
Step 5: Introduce the EntLib. Validation module information, the implementation level of the validators, and the use of various built-in validators-Part 1
Step 5: Introduce the EntLib. Validation module information, the implementation level of the validators, and the use of various built-in validators-Part 1
Step 5: Introduce the EntLib. Validation module information, the implementation level of the validators, and the use of various built-in validators-Part 2
Step 6: Use the Validation module for server-side data verification
Step 7: Simple Analysis of the Cryptographer encryption module, custom encryption interfaces, and usage-Part 1
Step 7: Simple Analysis of the Cryptographer encryption module, custom encryption interfaces, and usage-Part 2
Step 8. Use the Configuration Setting module and other methods to classify and manage enterprise database Configuration information
Step 9: Use the PolicyInjection module for AOP-PART1-basic usage
Step 9: Use the PolicyInjection module for AOP-PART2-custom Matching Rule
Step 9: Use the PolicyInjection module for AOP-PART3 -- Introduction to built-in Call Handler
Step 9: Use the PolicyInjection module for AOP-PART4 -- create a custom Call Handler to achieve user operation Logging
Step 10: Use Unity to decouple your system-PART1-Why use Unity?
Step 10: Use Unity to decouple your system-PART2-learn how to use Unity (1)
Step 10. Use Unity to decouple your system-PART2-learn how to use Unity (2)
Step 10: Use Unity to decouple your system-PART2-learn how to use Unity (3)
Step 10: Use Unity to decouple your system-PART3-dependency Injection
Step 10: Use Unity to decouple your system-PART4 -- Unity & PIAB
Extended learning:
Extended learning and dependency injection in libraries (rebuilding Microsoft Enterprise Library) [go]