Generic changes to generated code.

This commit is contained in:
Rich 2012-05-21 13:30:53 +00:00
parent f5544b7053
commit 683bf51ef8

View File

@ -464,7 +464,7 @@ public class GeneratedTemplate : DotNetScriptTemplate
[TypeConverter(typeof(<%=_className%>Converter))]<% [TypeConverter(typeof(<%=_className%>Converter))]<%
} }
%> %>
public partial class <%=_className%> : BusinessListBase<<%=_className%>, <%=_subclassName%>><%=sInterface%>, IVEHasBrokenRules public partial class <%=_className%> : BusinessListBase<<%=_className%>, <%=_subclassName%>><%=sInterface%>, IVEHasBrokenRules , IDisposable
{<% {<%
Log4Net(); Log4Net();
if (_chkPartBM)vlnBusinessMethodsFKList(fk,sAlias); if (_chkPartBM)vlnBusinessMethodsFKList(fk,sAlias);
@ -489,7 +489,7 @@ public class GeneratedTemplate : DotNetScriptTemplate
[TypeConverter(typeof(<%=_className%>Converter))]<% [TypeConverter(typeof(<%=_className%>Converter))]<%
} }
%> %>
public partial class <%=_className%> : BusinessBase<<%=_className%>><%=sInterface%>, IVEHasBrokenRules public partial class <%=_className%> : BusinessBase<<%=_className%>><%=sInterface%>, IVEHasBrokenRules, IDisposable
{<% {<%
Log4Net(); Log4Net();
if (_chkPartBM)vlnBusinessMethodsFKItem(fk,sAlias); if (_chkPartBM)vlnBusinessMethodsFKItem(fk,sAlias);
@ -563,8 +563,28 @@ public class GeneratedTemplate : DotNetScriptTemplate
this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i)); this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
} }
} }
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~<%=_className%>()
{
_CountFinalized++;
}
public void Dispose() public void Dispose()
{ {
if (_Disposed) return;
_CountDisposed++;
_Disposed = true;
foreach (<%=_subclassName%> tmp in this) foreach (<%=_subclassName%> tmp in this)
{ {
tmp.Changed -= new <%=_subclassName%>Event(tmp_Changed); tmp.Changed -= new <%=_subclassName%>Event(tmp_Changed);
@ -1420,8 +1440,28 @@ namespace <%=_nameSpace%>
{/* require use of factory methods */ {/* require use of factory methods */
AddToCache(this); AddToCache(this);
} }
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~<%=_className%>()
{
_CountFinalized++;
}
public void Dispose() public void Dispose()
{ {
if (_Disposed) return;
_CountDisposed++;
_Disposed = true;
RemoveFromDictionaries(); RemoveFromDictionaries();
} }
private void RemoveFromDictionaries() private void RemoveFromDictionaries()
@ -1774,14 +1814,19 @@ namespace <%=_nameSpace%>
{ {
<%=sCheck%> <%=sCheck%>
} }
private void BuildRefreshList() private void ClearRefreshList()
{ {
<%=sReset%> <%=sReset%>
}
private void BuildRefreshList()
{
ClearRefreshList();
AddToRefreshList(<%=sRefreshRelated1%>); AddToRefreshList(<%=sRefreshRelated1%>);
} }
private void ProcessRefreshList() private void ProcessRefreshList()
{ {
<%=sProcess%> <%=sProcess%>
ClearRefreshList();
} }
#endregion<% #endregion<%
} }
@ -3289,6 +3334,29 @@ private void vlnDataPortalFetch(string sPrefix,IColumns cols,string sql,bool get
MarkAsChild(); MarkAsChild();
Fetch(dr<%=sExtra2%>); Fetch(dr<%=sExtra2%>);
} }
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~<%=sFkClassListName%>()
{
_CountFinalized++;
}
public void Dispose()
{
if (_Disposed) return;
_CountDisposed++;
_Disposed = true;
}
#endregion<% #endregion<%
} }
private void vlnDataAccessPortalFKList(IForeignKey fk,string sAlias) private void vlnDataAccessPortalFKList(IForeignKey fk,string sAlias)
@ -4049,6 +4117,29 @@ private void vlnDataPortalFetch(string sPrefix,IColumns cols,string sql,bool get
MarkAsChild(); MarkAsChild();
Fetch(dr); Fetch(dr);
} }
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~<%=sFkClassName%>()
{
_CountFinalized++;
}
public void Dispose()
{
if (_Disposed) return;
_CountDisposed++;
_Disposed = true;
}
#endregion<% #endregion<%
} }
private void vlnDataAccessPortalFKItem(IForeignKey fk,string sAlias) private void vlnDataAccessPortalFKItem(IForeignKey fk,string sAlias)
@ -4630,8 +4721,28 @@ private void vlnDataPortalFetch(string sPrefix,IColumns cols,string sql,bool get
{/* require use of factory methods */ {/* require use of factory methods */
AddToCache(this); AddToCache(this);
} }
private bool _Disposed = false;
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
public static int CountCreated
{ get { return _CountCreated; } }
public static int CountNotDisposed
{ get { return _CountCreated - _CountDisposed; } }
public static int CountNotFinalized
{ get { return _CountCreated - _CountFinalized; } }
~<%=_className%>()
{
_CountFinalized++;
}
public void Dispose() public void Dispose()
{ {
if (_Disposed) return;
_CountDisposed++;
_Disposed = true;
RemoveFromCache(this); RemoveFromCache(this);
if (!_CacheByPrimaryKey.ContainsKey(<%=sRefKeys%>)) return; if (!_CacheByPrimaryKey.ContainsKey(<%=sRefKeys%>)) return;
List<<%=_className%>> list<%=_className%> = _CacheByPrimaryKey[<%=sRefKeys%>]; // Get the list of items List<<%=_className%>> list<%=_className%> = _CacheByPrimaryKey[<%=sRefKeys%>]; // Get the list of items