66020 members! Sign up to stay informed.

Sponsored Links


Resources

.NET Research Library
Get .NET related white papers, case studies and webcasts

News News News Messages: 21 Messages: 21 Messages: 21 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Microsoft Patterns and Practices Releases Enterprise Library

Posted by: Paul Ballard on January 31, 2005 DIGG
Enterprise Library is the latest upgrade to many of the Application Blocks previously released by the Microsoft P&P group. This new release contains seven separate libraries including Caching, Configuration, Exception Handling, Data Access, Cryptography, Logging, and Security. Unlike prior releases, these blocks also work together to form a coherent framework for .NET applications.

The Enterprise Library, developed jointly between Microsoft and Avanade, makes extensive use of XML configuration files for everything from database connections to cryptography settings. Configuration file management is made significantly easier though with the addition of a Windows based configuration tool. This tool reads in the configuration file(s) for a project and allows the developer to modify the configuration in a hierarchical way without having to actually edit the XML.

Each application block has had significant changes. Below is a brief list of the application blocks and their features.

  • Caching The caching block has been modified to be thread safe. It provides three types of caching mechanisms by default; in memory (Null), IsolatedStorage, and Database (via the Data Access Block). Native calls for memory mapped files are no longer supported out of the box. The caching mechanisms can be extended using the interfaces provided.
  • Configuration The configuration application block has been rebuilt to provide access to configuration data stored in XML and only XML. It no longer supports the Registry, Databases, or Key/Value pairs as a direct means of storing configuration data but can be extended to include that functionality. It does include encryption of data in the configuration store.
  • Exception Handling The exception handling block moves beyond the older versions simple logging and combines exception management with exception policies to provide an overall strategy for exception management. Now based on policy, exceptions can be caught, thrown, rethrown, or even ignored.
  • Data Access The Helper classes are gone, replaced now by specific instances of database wrappers accessed via a factory. This version includes support for SQL Server and Oracle but not OLEDB and DB2. Data providers can be extended to include these databases.
  • Cryptography This application block allows for simple access to cryptography using the methods defined in the cryptography configuration file. It provides both symmetric and hash algorithms used to encrypt strings (but not streams).
  • Logging and Instrumentation This application block has been modified to eliminate the dependency on EIF. It provides centralized logging to the Event Log, Email, MSMQ, files, WMI, and databases (via the Data Access block). Formatters are defined in the configuration files via the tool instead of XSLT.
  • Security The Security application block allows users to be authenticated based on credentials and then performs role based authorization without needing AuthorizationManager on Windows Server 2003. It also provides a caching mechanism for credentials (via the Caching block).

To download Enterprise Library including documentation, click here.

Threaded replies

·  Microsoft Patterns and Practices Releases Enterprise Library by Paul Ballard on Mon Jan 31 16:21:26 EST 2005
  ·  I don't like this library by Piotr Czarnas on Tue Feb 01 05:08:23 EST 2005
    ·  You do not have to load the entire library by Gregory Beamer on Tue Feb 01 12:52:27 EST 2005
      ·  XmlSerializer compiles classes by Piotr Czarnas on Tue Feb 01 15:39:51 EST 2005
        ·  Development by Jarrod Marshall on Tue Feb 01 16:27:19 EST 2005
        ·  Config load time by Tom Hollander on Tue Feb 01 19:04:02 EST 2005
          ·  Re: Config load time by Eduardo Miranda on Wed Feb 02 05:34:29 EST 2005
            ·  Re: Config load time by Tom Hollander on Wed Feb 02 10:06:51 EST 2005
              ·  Re: Config load time by Jarrod Marshall on Wed Feb 02 10:40:56 EST 2005
                ·  Config Load Time by Scott Densmore on Wed Feb 02 11:09:10 EST 2005
                  ·  Config Load Time by Jarrod Marshall on Wed Feb 02 12:03:14 EST 2005
                  ·  Re: Config Load Time by Piotr Czarnas on Wed Feb 02 18:10:37 EST 2005
                    ·  Re: Config Load Time by Tom Hollander on Thu Feb 03 18:20:20 EST 2005
                    ·  Re: Config Load Time by Scott Densmore on Thu Feb 03 18:34:43 EST 2005
                      ·  That's what the XGen tool is for! by Daniel Cazzulino on Thu Feb 03 18:42:55 EST 2005
                        ·  That's what the XGen tool is for! by Daniel Cazzulino on Thu Feb 03 18:43:44 EST 2005
                    ·  Re: Config Load Time by Len Fenster on Thu Feb 10 09:07:08 EST 2005
                      ·  Re: Config Load Time by Inge Schepers on Thu Mar 10 06:46:21 EST 2005
                        ·  Re: Config Load Time by Inge Schepers on Thu Mar 10 06:47:54 EST 2005
                        ·  Re: Config Load Time by Inge Schepers on Thu Mar 10 12:00:03 EST 2005
    ·  Compiling in Whidbey by Shanthu K on Thu Feb 17 10:34:41 EST 2005
  ·  Microsoft Patterns and Practices Releases Enterprise Library by Mehul Patel on Tue Feb 01 15:19:38 EST 2005
  Message #154883 Post reply Post reply Post reply Go to top Go to top Go to top

I don't like this library

Posted by: Piotr Czarnas on February 01, 2005 in response to Message #154826
I just downloaded it and did some testing.

So I wrote a simple windows form application with a text box an a button. When I click that button then the test in the text box is logged using

 Logger.Write(this.TextBoxMessage.Text);

I used the configuration tool (very nice!) and set up a flat file sink.

When I click the "Log" button then my simple application freezes for about 5 seconds (P4 2.6, 2 Gb ram) to load all assemblies of the Enterprise Library. Since then my simple application consumes 18 Mb more memory!

Maybe it is not a problem for a server application but it does matter for a windows forms ones.


Regards,

Piotr Czarnas

  Message #154979 Post reply Post reply Post reply Go to top Go to top Go to top

You do not have to load the entire library

Posted by: Gregory Beamer on February 01, 2005 in response to Message #154883
Piotr:

As you have the source code available, you can configure the parts of the library you wish to use. To log, you only have to compile and use the logging project in the library.

If this is still too slow, you have the option of ngenning the assembly on install and having it stored as native code.

Essentially, this new library is simply the Application Blocks refactored into a single solution. Pick and choose what you desire for your own solution.

Peace and Grace,

Greg

  Message #155013 Post reply Post reply Post reply Go to top Go to top Go to top

Microsoft Patterns and Practices Releases Enterprise Library

Posted by: Mehul Patel on February 01, 2005 in response to Message #154826
I dont know if this is practical , makes sense or not, here it goes.

Logging Block, UIP Block, etc are good ways to design an application, why cannt microsoft start putting this thing in standard codebase of .net framework.

Is it because some other people are developing for them? Or they do not want to endorse Blocks as standard way of doing things?

My take is merge it on .Net framework. Like JSR, people can put ideas, later a decide on it filter. Put some namespace like

System.Patterns.Construction

System.Patterns.Cache
System.Patterns.Logging
System.Patterns.UI.Windows
System.Patterns.UI.Windows.SmartClient
System.Patterns.UI.Web
System.Patterns.UI.Web.MVC
System.Patterns.UI.Web.MVC.FrontController

Put IHttpModule based FrontController patterns in there.

Don't start bunch of libraries that are just rarely used.

The reason i tell that, is open source project like Log4Net,
NANT are easier, configurable, lightweight. If you want to customize Enterprise Library, .Net Framework, your OS, your application, then its more work, people wont buy it.

Enterprise Library name has not taken so far, AB has to some extent. Not much though.

  Message #155015 Post reply Post reply Post reply Go to top Go to top Go to top

XmlSerializer compiles classes

Posted by: Piotr Czarnas on February 01, 2005 in response to Message #154979
Greg:

Believe me or not - ngen was the first thing I tried.
Now I am finally at home and I just found some time to investigate it any further.

This release of the logging block uses XmlSerializer to deserialize something - probably its configuration file.
When XmlSerializer constructor is called it is generating and compiling source code of helper XML serialization classes. It is csc.exe that consumes the whole time.

All previous building blocks were not using XmlSerializer and their XML configuration was loaded using classes from the System.Xml namespace.

As I heard this logging block was developed by Avenade, not by Microsoft but please correct me if I am wrong.

Regards,

Piotr Czarnas

  Message #155029 Post reply Post reply Post reply Go to top Go to top Go to top

Development

Posted by: Jarrod Marshall on February 01, 2005 in response to Message #155015
The majority of it was developed by Avanade. Some of it is a melding of Avanade's ACA.NET with prior application blocks. The greatest example of that is the Security Application block.

  Message #155046 Post reply Post reply Post reply Go to top Go to top Go to top

Config load time

Posted by: Tom Hollander on February 01, 2005 in response to Message #155015
You are correct that the blocks compile the XmlSerializer classes the first time the configuration needs to be read. For a server application this shouldn't be noticable at all, but it is something that needs to be taken into account on a smart client app. However it shouldn't be taking anywhere near 5 seconds under normal use. Possibly you didn't install the instrumentation for the block (WMI schemas, perf counters etc), and the block was trying to install all these things at first use. There is a script on the Start Menu that will do this for you, eliminating the runtime hit. Also once .NET 2.0 ships there will be an option to precompile XmlSerializers (the sgen tool) which will eliminate the compilation hit as well.

Regarding the development, the Enterprise Library project was run out of Microsoft. Microsoft did license some of the ACA.NET code from Avanade to accelerate development, in addition to reusing existing patterns & practices code and writing new code. The project team consisted of people from Microsoft, Avanade, Infosys and independent contractors.

Tom Hollander
Enterprise Library Product Manager
Microsoft patterns & practices

  Message #155093 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config load time

Posted by: Eduardo Miranda on February 02, 2005 in response to Message #155046
Hi Tom,

What about memory and processing consumption? Are this library good to run in a smart client? Or is it only for servers.

Thank you

Eduardo Miranda

  Message #155135 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config load time

Posted by: Tom Hollander on February 02, 2005 in response to Message #155093
I don't know the requirements for your app, but it should be great for most smart client apps. Again, I supsect that the memory/CPU consumption was related to the instrumentation being installed on first use.

Tom

  Message #155149 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config load time

Posted by: Jarrod Marshall on February 02, 2005 in response to Message #155135
NTD Smartclient apps are going to have a hard time using this without some extra work. The reason is the use of the multiple config files the EntLib Configuration app writes out. NTD only probes back to the server for <appname>.exe.config

It has no idea to look for dataConfiguration.config, exceptionHandlingConfiguration.config, etc.

I have not tried it with ClickOnce, but I'll post the results on my blog as soon as I have the opportunity to test it out.

I really haven't spent much time on it since I left Avanade.

  Message #155157 Post reply Post reply Post reply Go to top Go to top Go to top

Config Load Time

Posted by: Scott Densmore on February 02, 2005 in response to Message #155149
I know you take an initial hit for the load because of the XmlSerializer and if you don't like this you can write a storage provider or transformer that reads the Xml data using an XmlReader and then read the data into the object graph yourself. You would have to do this for each block, not that hard. The XmlSerializer was for us to create a general purpose. On the server, this is not a big problem, since the cost is once.

As far as the NTD, I will have a post today on how to create a storage provider that will work with the app.config file and write all information there. Of course it will still be general purpose.

  Message #155170 Post reply Post reply Post reply Go to top Go to top Go to top

Config Load Time

Posted by: Jarrod Marshall on February 02, 2005 in response to Message #155157
Great news Scott!

  Message #155236 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Piotr Czarnas on February 02, 2005 in response to Message #155157
Scott

I went much further. I just wanted to decrease the load time (the time since the first log entry is written). So I made a lot of magic. Thanks for our comment of a custom transformer.

First of all - implementing manually custom classes that traverse XML and read the configuration is not an option. To much work, a lot of testing required. I also didn't want to change a single line of the enterprise library.

I decided to force XmlSerializer not to generate serialization/deserialization classes and compile them.
As you probably know XmlSerializer has a "hidden" feature, if you put this special xml:

  <system.diagnostics>
    <switches>
      <add name="XmlSerialization.Compilation" value="4" />
    </switches>
  </system.diagnostics>

into your application config file, then XmlSerializer will not remove the source code of those dynamically generated serialization classes. You can find them in your temporary folder.

I did the following things:

1. I run the application once having this special switch in its config file. Several .cs files were created in the temp folder.

2. I created another library project, I copied those files and added them to the project.

3. I changed namespace names for all those generated files. A different namespace for each file. Each generated file contains two classes (the names are the same for all files). One class extends System.Xml.Serialization.XmlSerializationWriter, the other one extends System.Xml.Serialization.XmlSerializationReader.

4. I implemented a clever subclass of XmlSerializer:

using System;
using System.Reflection;
using System.Xml.Serialization;

namespace EnterpriseLibraryHelper
{
  /// <summary>
  /// Custom XmlSerializer that uses pregenerated XML serialization readers and writers.
  /// </summary>
  public class CustomXmlSerializer : XmlSerializer
  {
    private Type _readerType;
    private Type _writerType;

    public CustomXmlSerializer(Type readerType, Type writerType)
    {
      this._readerType = readerType;
      this._writerType = writerType;
    }

    protected override XmlSerializationReader CreateReader()
    {
      return (XmlSerializationReader)Activator.CreateInstance(this._readerType);
    }

    protected override XmlSerializationWriter CreateWriter()
    {
      return (XmlSerializationWriter)Activator.CreateInstance(this._writerType);
    }

    protected override void Serialize(object o, XmlSerializationWriter writer)
    {
      MethodInfo[] methods = writer.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance);

      MethodInfo writerMethod = null;

      foreach( MethodInfo methodInfo in methods )
      {
        ParameterInfo[] parameters = methodInfo.GetParameters();

        if( methodInfo.ReturnType == typeof(void) && parameters.Length == 1 &&
          parameters[0].ParameterType == typeof(object) )
        {
          writerMethod = methodInfo;
          break;
        }
      }

      writerMethod.Invoke(writer, new object[] { o });
    }

    protected override object Deserialize(XmlSerializationReader reader)
    {
      MethodInfo[] methods = reader.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance);

      MethodInfo readerMethod = null;

      foreach( MethodInfo methodInfo in methods )
      {
        ParameterInfo[] parameters = methodInfo.GetParameters();

        if( methodInfo.ReturnType == typeof(object) && parameters.Length == 0 )
        {
          readerMethod = methodInfo;
          break;
        }
      }

      return readerMethod.Invoke(reader, null);
    }
  }
}


Some description is required: I used reflection and searched for public instance methods because each of those classes (serializer and deserializer) contains exactly one public method that matches a special signature. It is a pity that those methods have always a different name - this name contains the name of the xml node.
My custom XmlSerializer inherits from System.Xml.XmlSerializer and overrides several methods whose description says "This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.".

If you want to use this XmlSerializer you instantiate it given the types of those two generated classes - xml deserializer and xml serializer.

5. Now I created my custom transformer provider that is a copy of Microsoft.Practices.EnterpriseLibrary.Configuration.Transformer.XmlSerializerTransformer except that its Initialize method loads the type names of those serializer/deserializer classes:

        public override void Initialize(ConfigurationView configurationView)
        {
            ArgumentValidation.CheckForNullReference(configurationView, "configurationCursor");
            ArgumentValidation.CheckExpectedType(configurationView, typeof(RuntimeConfigurationView));

            RuntimeConfigurationView runtimeConfigurationView = (RuntimeConfigurationView)configurationView;
            CustomTransformerData transformerData = (CustomTransformerData)runtimeConfigurationView.GetTransformerProviderData(CurrentSectionName);
            serializerType = Type.GetType(transformerData.Attributes["serializerType"], true);
            deserializerType = Type.GetType(transformerData.Attributes["deserializerType"], true);
        }


6. I also changed the last method of "my" transformer:

        private XmlSerializer CreateXmlSerializer(Type valueType)
        {
            return new CustomXmlSerializer(this.deserializerType, this.serializerType);
        }

Now I use my xml serializer!

7. There is one more class that is deserialized using XmlSerializer - it is the configuration section object stored in the application .config file. It is deserialized by a IConfigurationSectionHandler. I implemented my custom configuration section handler whose Create method uses my xml serializer:

        public object Create(object parent, object configContext, XmlNode section)
        {
            ConfigurationSettings configurationSettings = new ConfigurationSettings();
            if (section == null)
            {
                return configurationSettings;
            }
            XmlSerializer xmlSerializer = new CustomXmlSerializer(typeof(EnterpriseLibraryHelper.ConfigurationSettingsSerializer.XmlSerializationReader1), typeof(EnterpriseLibraryHelper.ConfigurationSettingsSerializer.XmlSerializationWriter1));
          configurationSettings = (ConfigurationSettings)xmlSerializer.Deserialize(new XmlTextReader(new StringReader(section.OuterXml)));
            return configurationSettings;
        }

8. Now the last thing: app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="enterpriselibrary.configurationSettings" type="EnterpriseLibraryHelper.ConfigurationManagerSectionHandler, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
  </configSections>
  <enterpriselibrary.configurationSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" applicationName="Application" xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
  <configurationSections>
    <configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="loggingConfiguration" encrypt="false">
      <storageProvider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="loggingConfiguration.config" />
      <dataTransformer xsi:type="CustomTransformerData" name="Xml Serializer Transformer turbo" type="EnterpriseLibraryHelper.XmlSerializerTransformer, EnterpriseLibraryHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
        <Attributes name="serializerType" value="EnterpriseLibraryHelper.LoggingSettingsSerializer.XmlSerializationWriter1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
        <Attributes name="deserializerType" value="EnterpriseLibraryHelper.LoggingSettingsSerializer.XmlSerializationReader1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
      </dataTransformer>
    </configurationSection>
    <configurationSection xsi:type="ReadOnlyConfigurationSectionData" name="loggingDistributorConfiguration" encrypt="false">
      <storageProvider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="loggingDistributorConfiguration.config" />
      <dataTransformer xsi:type="CustomTransformerData" name="Xml Serializer Transformer turbo" type="EnterpriseLibraryHelper.XmlSerializerTransformer, EnterpriseLibraryHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
        <Attributes name="serializerType" value="EnterpriseLibraryHelper.DistributorSettingsSerializer.XmlSerializationWriter1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
        <Attributes name="deserializerType" value="EnterpriseLibraryHelper.DistributorSettingsSerializer.XmlSerializationReader1, EnterpriseLibraryHelper, Version=1.0, Culture=neutral, PublicKeyToken=null" />
      </dataTransformer>
    </configurationSection>
  </configurationSections>
  <keyAlgorithmStorageProvider xsi:nil="true" />
  <includeTypes />
</enterpriselibrary.configurationSettings>
</configuration>



Some statistics:
that "magic" EnterpriseLibraryHelper assembly that now contains the pregenerated serializers is 288 kb of C# code.
The source code that I posted to this entry is the only code that I created myself - the rest was generated by XmlSerializer.

Now my small test application starts in less than 1 second!

Maybe somebody wants to host the source code?


Piotr Czarnas

  Message #155415 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Tom Hollander on February 03, 2005 in response to Message #155236
Hi Piotr -

Looks great - thanks for sharing. If you want to make this available as source, the best thing to do is go to the gotdotnet workspace at http://workspaces.gotdotnet.com/entlib and post a zipped version of the source and any readmes to the User Samples section. You should also post to the gotdotnet message board to let the community know that you've done this.

thanks
Tom

  Message #155416 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Scott Densmore on February 03, 2005 in response to Message #155236
Piotr,

Very Cool! You guys are going faster than I can. I have some work is taking some cycles, but I will have a custom extensions for doing the same exact thing. Go to mvp-xml.sf.net and you will find a lot of cool things.

  Message #155417 Post reply Post reply Post reply Go to top Go to top Go to top

That's what the XGen tool is for!

Posted by: Daniel Cazzulino on February 03, 2005 in response to Message #155416
Guys, generating design-time, event-rising, custom XmlSerializer is the core business of the XGen tool (http://www.google.com/url?sa=U&start=1&q=http://weblogs.asp.net/cazzu/posts/XGenToolRelease.aspx) in the Mvp.Xml project (http://mvp-xml.sf.net) design package.

Just assign the custom tool to your class, and you'll get our custom serializer!

  Message #155418 Post reply Post reply Post reply Go to top Go to top Go to top

That's what the XGen tool is for!

Posted by: Daniel Cazzulino on February 03, 2005 in response to Message #155417
Link should be: http://weblogs.asp.net/cazzu/posts/XGenToolRelease.aspx

  Message #156415 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Len Fenster on February 10, 2005 in response to Message #155236
Piotr,

This is very nice. If you're cool with it, as per Scott's suggestion, I will take the idea behind this code and merge it with serializers as generated by the mvp.xml tool to create an MvpSerializerTranformer. I will also create a design time dll so it will be easy to snap an MvpSerializerTranformer in place of ones XmlSerializerTransformer.

Thanks,

Lenny

  Message #157237 Post reply Post reply Post reply Go to top Go to top Go to top

Compiling in Whidbey

Posted by: Shanthu K on February 17, 2005 in response to Message #154883
Since they released this library so late( or recently), they could have made sure that this thing compiles in whidbey also.

First of all, it took for them so long how cumbersome EIF+Exception block stuff was.

Now I know how they are spending their 40B cash ;)

  Message #160784 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Inge Schepers on March 10, 2005 in response to Message #156415
The latest patch for the entlib contains a MvpSerliazerTransformer class. I don't know if this is yours (Lenny). If it is, could you please post a detailed explanation (preferably set by step) on how to use it? I have tried modifying an existing Ap.config file for data access with it. However, the config tool keeps throwing errors at me. Something to do with the type attribute of the xmlSerializerSection in my separate dataConfiguration.config file.

I also tried modifying the files manually, but keep getting errors (probably because I don't know exactly what settings are supposed to go where for the MvpSerializerTransformer to work).

Any help would be greatly appreciated!

Inge

  Message #160786 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Inge Schepers on March 10, 2005 in response to Message #160784
Oops... set by step --> step by step :)

  Message #160877 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Config Load Time

Posted by: Inge Schepers on March 10, 2005 in response to Message #160784
Okay, I finally got this thing to work. With some unexpected modifications.

I never got the config tool to work so it would create the correct configuration file for using the MvpSerializerFormatter. That could be due to my ignorance, though. However, I was able to create the config files manually.

(Sorry for the messy Xml)
My App.config file contains the following Xml:

<configuration>
  <configSections>
    <section
      name="enterpriselibrary.configurationSettings"
type="Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationManagerSectionHandler, Microsoft.Practices.EnterpriseLibrary.Configuration" />
  </configSections>
  <enterpriselibrary.configurationSettings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    defaultSection="" applicationName="Application"
xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
    <configurationSections>
      <configurationSection name="dataConfiguration"
        encrypt="false">
        <storageProvider
          xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="dataConfiguration.config" />
        <dataTransformer
          xsi:type="MvpSerializerTransformerData"
          name="Xml Serializer Transformer" type="EnterpriseLibrary.Extensions.MvpSerializerTransformer, EnterpriseLibrary.Extensions"
serializationType="SPWrapper.DatabaseSettingsSerializer, SPWrapper">
        </dataTransformer>
      </configurationSection>
    </configurationSections>
    <includeTypes>
      <includeType name="MvpSerializerTransformerData" type="EnterpriseLibrary.Extensions.Configuration.MvpSerializerTransformerData, EnterpriseLibrary.Extensions" />
    </includeTypes>
    <keyAlgorithmStorageProvider xsi:nil="true" />
  </enterpriselibrary.configurationSettings>
</configuration>

I had to add the includeTypes so the serialization classes would be known.

The Xml in the dataConfiguration.config now looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<dataConfiguration>
  <enterpriseLibrary.databaseSettings
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    defaultInstance="pubs"
xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/data">
    <databaseTypes>
      <databaseType name="Sql Server" type="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase, Microsoft.Practices.EnterpriseLibrary.Data" />
    </databaseTypes>
    <instances>
      <instance name="pubs" type="Sql Server"
        connectionString="DefaultConnectionString" />
    </instances>
    <connectionStrings>
      <connectionString name="DefaultConnectionString">
<parameters>
<parameter name="database" value="pubs"
            isSensitive="false" />
<parameter name="Integrated Security"
            value="True" isSensitive="false" />
<parameter name="server" value="localhost"
            isSensitive="false" />
</parameters>
      </connectionString>
    </connectionStrings>
  </enterpriseLibrary.databaseSettings>
</dataConfiguration>

I had to remove the <xmlSerializerSection> node because that threw an error when using the Mvp serialization classes and the generated typed serializers (Mvp.Xml.XGen serializers).

This is how I got it to work for me. I can't help but think there should be an easier way to accomplish this. If anyone knows of other ways to do this, please post a reply here.

Inge

 
New content on TheServerSide.NETNew content on TheServerSide.NETNew content on TheServerSide.NET

DSLs and language interop

Language "mashups" will become more prominent, and developers will become polyglots, one programmer suggests.

VS 2008 Resources

SearchWinDevelopment.com offers an introduction to the language, performance, testing and data management improvements in VS 2008.

VB code downloads home

VBCode.com code snippets cover all aspects of application development, from data binding to security to the user interface.

XAML Learning Guide

Get up to date on XAML best practices with a variety of articles, tutorials and webcasts. [SearchWinDevelopment.com]

Company uses VSTS DB edition to tame workflow

One team's experience with the VSTS DB edition suggests that it can improve workflow for dev teams. It also enhanced Agile efforts. (June 24, Article)

Book: Intro to DSL Tools

Microsoft has begun to include DSL tools in the VSTS kit. A new book by Steve Cook and other VSTS team members helps set the stage. (June 24, Article)

I See the Silverlight Shining!

Cartoon: Be it ever so humble there is no place like your home after you get a Microsoft Home Server . (June 18, Cartoon)

A look at .NET 3.5

Microsoft's Thom Robbins says new technology to highlight in NET 3.5 includes AJAX, LINQ for both C# and VB, as well as tooling enhancements intended to ease the task of building WPF, WF and WCF apps. (June 29, Podcast)

Venkat Subramaniam on AJAX

Venkat Subramaniam discusses AJAX bottlenecks, the tenets of Agile development and more. He spoke at the Ajax Experience. (June 25, Tech Talk)

Building a Claims-Based Security Model in WCF - Part 2

In the second of a two-part series, Michele Leroux Bustamente discusses design decisions related to the claims-based security model. Read the story and walk through the process for creating a set of claims-based utilities to encapsulate claims authorization at the service tier. (May 24, Article)

Introducing the Entity Framework

Understanding why the Entity Framework exists and learning where it can fit into your projects can get you prepared for the eventual release early next year. (May 10, Article)

WCF Security Learning Guide

Resource: This learning guide gives you quick access to useful links on Windows Communication Foundation security information. (April 24, Article)

Brad Abrams: Patterns for successful ASP.NET AJAX development

TSS.NET's Jack Vaughan spoke recently spoke with Microsoft's Brad Abrams to find out what he is seeing in the field and what the chefs in Redmond are cooking. Along the way he discusses patterns of AJAX frameworks. (April 11, Article)

Building a Claims-Based Security Model in WCF

In a two-part series, Michele Leroux Bustamente explains how claims-based security is supported by WCF, and how you can implement a claims-based security model for your services. (March 29, Article)

Authoring workflow using XAML

Windows Workflow Foundation is a new technology that many developers will need to get their heads around. In a brief excerpt adapted from Programming Windows Workflow Foundation: Practical WF Techniques and Examples using XAML and C#, K.Scott Allen considers aspects of workflow definition. (March 22, Chapter Excerpt)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map