mail-archives/mono-list/2003-October/016546.html

145 строки
4.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-list] ProviderSectionHandler revisited
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:marco.canini%40fastwebnet.it">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="016545.html">
<LINK REL="Next" HREF="016576.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-list] ProviderSectionHandler revisited
</H1>
<B>Marco Canini
</B>
<A HREF="mailto:marco.canini%40fastwebnet.it"
TITLE="[Mono-list] ProviderSectionHandler revisited">marco.canini@fastwebnet.it
</A><BR>
<I>Fri, 24 Oct 2003 15:47:52 +0200</I>
<P><UL>
<LI> Previous message: <A HREF="016545.html">[Mono-list] ProviderSectionHandler revisited
</A></li>
<LI> Next message: <A HREF="016576.html">[Mono-list] ProviderSectionHandler revisited
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#16546">[ date ]</a>
<a href="thread.html#16546">[ thread ]</a>
<a href="subject.html#16546">[ subject ]</a>
<a href="author.html#16546">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>This is a multi-part message in MIME format.
--------------040600060800040208080407
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Ok, here's the attachment :-)
Marco Canini wrote:
&gt;<i> I attach here a modified versrion of ProviderSectionHandler that solves
</I>&gt;<i> some pbs i had while trying to use mono.data.providerfactory.
</I>&gt;<i> A more detailed comment is included in the file header.
</I>&gt;<i>
</I>&gt;<i> I don't send a patch because last time Miguel wasn't able to apply.
</I>&gt;<i>
</I>&gt;<i> I modified ProviderSectionHandler.cs shipped with mcs 0.28
</I>&gt;<i>
</I>&gt;<i> Please commit it to CVS and let Mono.Data.dll be built by default in
</I>&gt;<i> make all.
</I>&gt;<i>
</I>&gt;<i> If you've questions i'm here.
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Mono-list maillist - <A HREF="mailto:Mono-list@lists.ximian.com">Mono-list@lists.ximian.com</A>
</I>&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/mono-list">http://lists.ximian.com/mailman/listinfo/mono-list</A>
</I>&gt;<i>
</I>
--------------040600060800040208080407
Content-Type: text/plain;
name=&quot;ProviderSectionHandler.cs&quot;
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename=&quot;ProviderSectionHandler.cs&quot;
//
// Mono.Data.ProviderSectionHandler
//
// Authors:
// Brian Ritchie (<A HREF="mailto:brianlritchie@hotmail.com">brianlritchie@hotmail.com</A>)
//
//
// Copyright (C) Brian Ritchie, 2002
//
// Modified by Marco Canini &lt;<A HREF="mailto:marco.canini@fastwebnet.it">marco.canini@fastwebnet.it</A>&gt; on 24 October 2003
// * Use XPath to select all provider node under providers to get sure it doesn't
// throw exception when there're comments and whitespaces in providers node
using System;
using System.Xml;
using System.Configuration;
namespace Mono.Data
{
public class ProviderSectionHandler : IConfigurationSectionHandler
{
public virtual object Create(object parent,object configContext,XmlNode section)
{
ProviderCollection providers = new ProviderCollection ();
XmlNodeList ProviderList = section.SelectNodes (&quot;./provider&quot;);
foreach (XmlNode ProviderNode in ProviderList) {
Provider provider = new Provider (
GetStringValue (ProviderNode,&quot;name&quot;,true),
GetStringValue (ProviderNode,&quot;connection&quot;,true),
GetStringValue (ProviderNode,&quot;adapter&quot;,true),
GetStringValue (ProviderNode,&quot;command&quot;,true),
GetStringValue (ProviderNode,&quot;assembly&quot;,true),
GetStringValue (ProviderNode,&quot;description&quot;,false));
providers.Add (provider);
}
return providers;
}
private string GetStringValue(XmlNode _node, string _attribute, bool required)
{
XmlNode a = _node.Attributes.RemoveNamedItem (_attribute);
if (a == null) {
if (required)
throw new ConfigurationException (&quot;Attribute required: &quot; + _attribute);
else
return null;
}
return a.Value;
}
}
}
--------------040600060800040208080407--
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="016545.html">[Mono-list] ProviderSectionHandler revisited
</A></li>
<LI> Next message: <A HREF="016576.html">[Mono-list] ProviderSectionHandler revisited
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#16546">[ date ]</a>
<a href="thread.html#16546">[ thread ]</a>
<a href="subject.html#16546">[ subject ]</a>
<a href="author.html#16546">[ author ]</a>
</LI>
</UL>
</body></html>