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 wasn't until last year when I was working on a project.CodeWhen the generation tool saw that many generation tools have built-in database access to the enterprise database and some related modules, it suddenly came to an epiphany that the enterprise database may still be a bit useful, as a result, 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 encapsulated many frequently-used modules for us in the enterprise database, such: database Access, caching, logs, exception handling, encryption, IOC, etc. In daily project development, the Enterprise Library runs through a module that is basically used by a project from the underlying layer to the presentation layer, this 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 applications Program Module and core architecture. 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 dependency 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 cause random errors that are difficult 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 the explicit dbdatareader. Close method is disabled or the dbdatareader is forced to be released.
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
9. microsoft. practices. enterpriselibrary. configuration. design. DLL set functions and other design-time sets are a new set of Microsoft. practices. enterpriselibrary. configuration. designtime. DLL instead.
10. Performance Counter exception moved 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 database and learning about the 5.0 changes, you will start to learn officially. The best way to learn is not to look at the enterprise database.Source code(I can't understand), but 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.
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 dependency 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 the explicit dbdatareader. Close method is disabled or the dbdatareader is forced to be released.
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
9. microsoft. practices. enterpriselibrary. configuration. design. DLL set functions and other design-time sets are a new set of Microsoft. practices. enterpriselibrary. configuration. designtime. DLL instead.
10. Performance Counter exception moved 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.