CodeSmith CS Templates - Enhancements to Xml DataSourceCodeSmith CS Templates - Enhancements to Xml DataSource
Old forum URL: forums.lhotka.net/forums/t/1510.aspx
rasupit posted on Monday, October 16, 2006
I've been working on a few enhancements to support xml datasource. I have added an xml schema to help validate when creating xml input. All generation options can be defined in xml file. There are other improvements that you just need to find out for your self. You can download the code at
http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=CSLAcontrib&ReleaseId=797To create xml data source, add CslaProject.xsd in your file as follow:
<?xml version="1.0" encoding="UTF-8"?>
<CslaProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Projects\CslaProject.xsd">
<!-- define csla objects here -->
</CslaProject>
Use editor such as VisualStudio or Xml Spy to get intellisense when editing the file.
Enjoy,
Ricky Supit
NB: I've included a sample file MySample.xml; This file is not intended to be a working project but it is intended to be a showcase of features that currently available. So please do not ask me why it does not generate code like PTracker.
JoOfMetL replied on Wednesday, October 18, 2006
Hi Ricky, nice job.
But a little mistake :
replace :
case CommonRuleHandler.GenericsMaxValue:
return string.Format("new CommonRules.MaxValueRuleArgs<{1}>(\"{0}\", {1})", _targetType, _targetName, argValue);
by :
case CommonRuleHandler.GenericsMaxValue:
return string.Format("new CommonRules.MaxValueRuleArgs<{0}>(\"{1}\", {2})", _targetType, _targetName, argValue);
JoOfMetL replied on Wednesday, October 18, 2006
an another mistake :
PropertyInfo :
Replace
case "allowDbNull":
_allowDbNull = bool.Parse(xtr.Value);
by
case "allowdbnull":
rasupit replied on Wednesday, October 18, 2006
JoOfMetL,
Thanks for the report, I have fixed this and package a new build (8718)
Ricky
JoOfMetL replied on Thursday, October 19, 2006
Hi, a little mistake
replace :
public string Inherits
{
.....
case ObjectType.NameValueList:
return string.Format(" : {0}<{2}, {2}>", _baseClass, ((PropertyInfo)_uniqueProperties[0]).Type, ((PropertyInfo)_properties[1]).Type);
}
return string.Empty;
}
}
by :
return string.Format(" : {0}<{1}, {2}>", _baseClass,
Copyright (c) Marimer LLC