[ 
http://issues.apache.org/jira/browse/IBATISNET-83?page=comments#action_12313732 
] 

Ron Grabowski commented on IBATISNET-83:
----------------------------------------

Hrmm, I don't think this is necessary. I think what we have now is fine. We 
provide a easy to use helper function for the user to access embedded resources:

 XmlDocument document = Resources.GetEmbeddedResourceAsXmlDocument(resource);

If you _really_ want to do it on one line you could to do this:

 Configure(Resources.GetEmbeddedResourceAsXmlDocument(resource));

I agree that embedded resources seem to be populate with developers on the 
list, but I'm afraid if we add a special method for embedded resources, people 
will want  helper methods for other things as well:

 // NOT GOOD!
 ConfigureWithAbsolutePath(string absolutePath)
 ConfigureWithRelativePath(string relativePath)
 ConfigureFromWebSite(string url, string username, string password)

I think IBATISNET-69 did a good job of clearning up the Configure method issue.

Using a seperate call to Resources.GetEmbeddedResourceAsXmlDocument allows the 
developer to recover from the case of the embedded resource not being found 
rather than IBatisNet throwing a generic exception.

> Add ConfigureWithEmbeddedResource methods to DomSqlMapBuilder and 
> DomDaoManagerBuilder classes
> ----------------------------------------------------------------------------------------------
>
>          Key: IBATISNET-83
>          URL: http://issues.apache.org/jira/browse/IBATISNET-83
>      Project: iBatis for .NET
>         Type: New Feature
>  Environment: IBatisNet source revision 190788
>     Reporter: Chris Weisel
>     Assignee: Gilles Bayon
>     Priority: Trivial

>
> For simple convenience, it would be nice to have the ability to configure 
> SqlMaps and DaoManagers directly from embedded config files.  Currently, a 
> call must be made to 
> IBatisNet.Common.Utilities.Resources.GetEmbeddedResourceAsXmlDocument() or 
> something equivalent and then then the resulting XmlDocument passed into the 
> Configure(XmlDocument document) method of the respective builder class.  
> The following method is for DomSqlMapBuilder:
> /// <summary>
> ///  Configure a SqlMapper from an embedded resource
> /// </summary>
> /// <param name="resource">Location of the embedded resource</param>
> /// <returns>An SqlMap</returns>
> public SqlMapper ConfigureWithEmbeddedResource(string resource)
> {
>  XmlDocument document = Resources.GetEmbeddedResourceAsXmlDocument( resource 
> );
>  return Build( document, false);
> }
> The following method is for DomDaoManagerBuilder: 
> /// <summary>
> ///  Configure DaoManagers from an embedded xml document.
> /// </summary>
> /// <param name="resource">An embedded resource</param>
> public void ConfigureWithEmbeddedResource(string resource)
> {
>  XmlDocument document = Resources.GetEmbeddedResourceAsXmlDocument(resource);
>  BuildDaoManagers( document, false );
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to