Hi,
Using:
netTiers v2.0.1.471 (The latest trunk from svn is producing the same results)
SQL Server 2005 and DB Script from this post
Code modified from this post posted below.
CSP file included below
StackOverflowException always occurs somewhere within DataRepository.StudentProvider.DeepSave(tm, student); Obviously, usually in a different place.
cheers
nkerkin
Failing Code:
///////////////////////////////////////////////////////////////////////////
private void Form1_Load(object sender, EventArgs e)
{
Teacher teacher = new Teacher();
teacher.Name = "MyteacherName8";
Student student = new Student();
student.Name = "MystudentName9";
Student student2 = new Student();
student2.Name = "MystudentName10";
Student student3 = new Student();
student3.Name = "MystudentName11";
teacher.StudentCollection_From_StudentTeacher.Add(student);
teacher.StudentCollection_From_StudentTeacher.Add(student2);
teacher.StudentCollection_From_StudentTeacher.Add(student3);
//Add the entities, and add references to the newly created entities.
//the identity mappings will occur as each one is updated automatically in the provider.
StudentTeacher both = new StudentTeacher();
both.TeacherIDSource = teacher;
both.StudentIDSource = student;
StudentTeacher both2 = new StudentTeacher();
both2.TeacherIDSource = teacher;
both2.StudentIDSource = student2;
StudentTeacher both3 = new StudentTeacher();
both3.TeacherIDSource = teacher;
both3.StudentIDSource = student3;
teacher.StudentTeacherCollection.Add(both);
teacher.StudentTeacherCollection.Add(both2);
teacher.StudentTeacherCollection.Add(both3);
using (TransactionManager tm = DataRepository.Provider.CreateTransaction())
{
tm.BeginTransaction();
DataRepository.TeacherProvider.DeepSave(tm, teacher);
tm.Commit();
}
}
///////////////////////////////////////////////////////////////////////////
csp:
///////////////////////////////////////////////////////////////////////////
<?xml version="1.0"?>
<codeSmith xmlns="http://www.codesmithtools.com/schema/csp.xsd">
<propertySets>
<propertySet output="NetTiers.txt" template="C:\Dev\netTiers2.0.1\NetTiers.cst">
<property name="ExecuteSql">True</property>
<property name="SQLFolderName">SQL</property>
<property name="ViewReport">True</property>
<property name="LaunchVisualStudio">True</property>
<property name="IncludeUnitTest">NUnit</property>
<property name="IncludeComponentLayer">ServiceLayer</property>
<property name="IncludeDatabaseFeatures">SQLServer2005</property>
<property name="IncludeWCFDataAttributes">False</property>
<property name="SerializeEntityState">False</property>
<property name="IncludeXmlAttributes">False</property>
<property name="CustomCodeFolderName">App_Code</property>
<property name="BusinessLogicLayerNameSpace">Entities</property>
<property name="DataAccessLayerNameSpace">Data</property>
<property name="UnitTestsNameSpace">UnitTests</property>
<property name="SignAssembly">False</property>
<property name="GenerateWebLibrary">False</property>
<property name="IncludeDesignTimeSupport">False</property>
<property name="GenerateWebservice">False</property>
<property name="AttemptCreateLocalVirtualDirectory">False</property>
<property name="GenerateWebsite">False</property>
<property name="UseWebAppProject">False</property>
<property name="OverwriteWebConfig">False</property>
<property name="IncludeAtlasLibrary">False</property>
<property name="IncludeAtlasToolkit">False</property>
<property name="GenerateWebsiteAdmin">False</property>
<property name="WebAdminSiteName">Application Name</property>
<property name="RetryEnabled">False</property>
<property name="RetryMaxAttempts">5</property>
<property name="RetrySleepTime">1000</property>
<property name="IncludeCustoms">True</property>
<property name="CustomNonMatchingReturnType">DataSet</property>
<property name="IncludeDrop">True</property>
<property name="IncludeInsert">True</property>
<property name="IncludeUpdate">True</property>
<property name="IncludeSave">True</property>
<property name="IncludeDelete">True</property>
<property name="IncludeGet">True</property>
<property name="IncludeGetList">True</property>
<property name="IncludeGetListByFK">True</property>
<property name="IncludeGetListByIX">True</property>
<property name="IncludeFind">True</property>
<property name="IncludeManyToMany">True</property>
<property name="IncludeRelations">True</property>
<property name="IsolationLevel">None</property>
<property name="InsertSuffix">_Insert</property>
<property name="UpdateSuffix">_Update</property>
<property name="DeleteSuffix">_Delete</property>
<property name="SelectSuffix">_Get</property>
<property name="SelectAllSuffix">_List</property>
<property name="FindSuffix">_Find</property>
<property name="GenerateWinLibrary">True</property>
<property name="RootNameSpace">GenerationTest</property>
<property name="OutputDirectory">c:\NetTiers\GenerationTest</property>
<property name="MappingFile">c:\NetTiers\GenerationTest\GenerationTestMapping.config</property>
<property name="ComponentLayerNameSpace">Services</property>
<property name="SourceTables">
<connectionString>Password=XXXX;Persist Security Info=True;User ID=XXXX;Initial Catalog=GenerationTest;Data Source=XXXX</connectionString>
<providerType>SchemaExplorer.SqlSchemaProvider,SchemaExplorer.SqlSchemaProvider</providerType>
<tableList>
<table>
<owner>dbo</owner>
<name>Teacher</name>
</table>
<table>
<owner>dbo</owner>
<name>Student</name>
</table>
<table>
<owner>dbo</owner>
<name>StudentTeacher</name>
</table>
</tableList>
</property>
<property name="WebServiceOutputPath">c:\NetTiers\GenerationTest\WebServices</property>
<property name="WebServiceUrl">http://localhost/GenerationTestServices</property>
<property name="ChooseSourceDatabase">
<connectionString>Password=li5ter;Persist Security Info=True;User ID=AntibioticUtilisation;Initial Catalog=GenerationTest;Data Source=PIGPEN</connectionString>
<providerType>SchemaExplorer.SqlSchemaProvider,SchemaExplorer.SqlSchemaProvider</providerType>
</property>
<property name="CompanyName">ait</property>
<property name="CompanyURL">ait.com.au</property>
<property name="RetrySleepStyle">Constant</property>
<property name="MethodNames">
<MethodNamesProperty xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="">
<Get>Get</Get>
<GetAll>GetAll</GetAll>
<GetPaged>GetPaged</GetPaged>
<Find>Find</Find>
<Insert>Insert</Insert>
<Update>Update</Update>
<Save>Save</Save>
<Delete>Delete</Delete>
<DeepLoad>DeepLoad</DeepLoad>
<DeepSave>DeepSave</DeepSave>
<GetTotalItems>GetTotalItems</GetTotalItems>
<BulkInsert>BulkInsert</BulkInsert>
</MethodNamesProperty>
</property>
<property name="StrippedTablePrefixes">tbl;tbl_</property>
<property name="EntityFormat">{0}</property>
<property name="CollectionFormat">{0}Collection</property>
<property name="GenericViewFormat">VList<{0}></property>
<property name="GenericListFormat">TList<{0}></property>
<property name="ProviderFormat">{0}Provider</property>
<property name="InterfaceFormat">I{0}</property>
<property name="BaseClassFormat">{0}Base</property>
<property name="EnumFormat">{0}List</property>
<property name="ManyToManyFormat">{0}From{1}</property>
<property name="ServiceClassNameFormat">{0}Service</property>
<property name="ParseDbColDefaultVal">False</property>
<property name="ChangeUnderscoreToPascalCase">False</property>
<property name="AliasFilePath" />
<property name="ProcedurePrefix">_sp</property>
<property name="CustomProcedureStartsWith">_{0}_</property>
<property name="CSPUseDefaultValForNonNullableTypes">False</property>
</propertySet>
</propertySets>
</codeSmith>