Do you have a memory leak using NHibernate?
Are you doing a lot of processing in a loop, get, process, save, repeat,?
Well, firstly it's not really a leak... it's how Nhibernate works, and seeing as a leak
indicates you're probably not using NHibernate remotely how it's supposed to be used...
But then again , so are we... I have a winforms application generating reports for lots of students in a row... Once processed I'm completely done with the student and not going back...
So I needed to flush everything out of the Nhibernate cache, both layer 1 and 2.
Now If you're going to use this realize it almost certainly means you're using Nhibernate incorrectly...
and you'd probably be better off just going back to Ado... more speed, less memory used...
But that said, here's how to flush it all
SuperFlushJcdcSessionFirstAndSecondCaches();
Ha Hah just kidding, here's the part you really want...
public void SuperFlushJcdcSessionFirstAndSecondCaches(
{
INHFactory eFolderDocFactory = ObjectFactory.GetNamedInstance<INHFactory>( "JCDC" );
ISessionFactory sessionFactory = eFolderDocFactory.GetFactory();
// FROM http://stackoverflow.com/questions/2660714/how-to-clear-the-entire-second-level-cache-in-nhibernate - EWB
sessionFactory.EvictQueries();
foreach ( var collectionMetadata in sessionFactory.GetAllCollectionMetadata() )
{ sessionFactory.EvictCollection( collectionMetadata.Key );
}
foreach ( var classMetadata in sessionFactory.GetAllClassMetadata() )
{ sessionFactory.EvictEntity( classMetadata.Key )
}
}
Thursday, March 27, 2014
Friday, March 7, 2014
Brace Matching Hotkeys in Visual Studio...
I'm sure most of you are know about the matching brace highlighting feature in Visual Studio...
If you double click to select a brace, it's matching brace is highlighted in the same color...
Great, awesome for the file types where it works.. but what about the file types where it DOESN'T work?
Here where my tip of the <however often I decide to add tips> comes in...
In any file, say a razor view, click next to a brace, hit <ctrl>, ]... It jumps to the matching brace...
Bam,
Darn handy.
(I use resharper and the resharper keyboard settings , so YMMV, etc)
Sunday, February 23, 2014
Saturday, February 15, 2014
Flow jet cutting from an illustrator file.
There is a special export trick for exporting AI files to work in flow.
It's on page 8 of the flowjet SBU document
here it is in summary
edit_>preferences->units make sure it's inches
File-> save as-> save as .ai file
when you click save, in teh top field select "illustrator 3" as your version #
openthe file in corel draw
gott file-> export, delct DXF - AutoCad
when you select export in the top field select "autocad r10"
the segments will be disconnected bu flowpath can autopath it.
There is a special export trick for exporting AI files to work in flow.
It's on page 8 of the flowjet SBU document
here it is in summary
edit_>preferences->units make sure it's inches
File-> save as-> save as .ai file
when you click save, in teh top field select "illustrator 3" as your version #
openthe file in corel draw
gott file-> export, delct DXF - AutoCad
when you select export in the top field select "autocad r10"
the segments will be disconnected bu flowpath can autopath it.
Friday, January 17, 2014
RDLC alternating row color, by group instead of by line
A common task in RDLC reporting is alternate row styling, here are the 3 most common types.
Regular alternating row styles
= iif(RowNumber(Nothing) mod 2, "LightGrey", "Transparent")
Alternating group colors:
http://bidn.com/blogs/briankmcdonald/bidn-blog/713/alternating-group-colors
Alternating group colors with alternating row colors inside the group.
http://www.bidn.com/blogs/briankmcdonald/bidn-blog/717/alternating-group-colors-and-alternating-row-colors
Regular alternating row styles
= iif(RowNumber(Nothing) mod 2, "LightGrey", "Transparent")
Alternating group colors:
http://bidn.com/blogs/briankmcdonald/bidn-blog/713/alternating-group-colors
Alternating group colors with alternating row colors inside the group.
http://www.bidn.com/blogs/briankmcdonald/bidn-blog/717/alternating-group-colors-and-alternating-row-colors
Wednesday, September 4, 2013
Structuremap 202 errors..... The two most powerful lines for fixing 202 type errors in Structure map.
If you are using strcutrue map you are familiar with 202 errors.
If you've seen my list of them and their causes it's a big help in fixing them.
Either way here are two powerful lines for diagnosing what's wrong.
#1:
Debug.WriteLine( ObjectFactory.WhatDoIHave() );
Writes out everything loaded by Structure map... like this:
....
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ICodeDAL (JCDCHelper.DBCodes.Interfaces.ICodeDAL) JCDCHelper.DBCodes.DataObjects.CodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null JCDCHelper.DBCodes.DataObjects.CodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null
Scoped as: PerRequest
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ISpamisCodeDAL (JCDCHelper.DBCodes.Interfaces.ISpamisCodeDAL) JCDCHelper.DBCodes.DataObjects.SpamisCodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null JCDCHelper.DBCodes.DataObjects.SpamisCodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null
Scoped as: PerRequest
....
and #2:
ObjectFactory.AssertConfigurationIsValid();
Looks for obvious errors and gives you better information to fix them... are you haunted by the words "Or one of it's dependencies" this is the tool for you.
Give them a try... Not magic bullets, but a huge help.
Good luck
Cal-
If you've seen my list of them and their causes it's a big help in fixing them.
Either way here are two powerful lines for diagnosing what's wrong.
#1:
Debug.WriteLine( ObjectFactory.WhatDoIHave() );
Writes out everything loaded by Structure map... like this:
....
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ICodeDAL (JCDCHelper.DBCodes.Interfaces.ICodeDAL) JCDCHelper.DBCodes.DataObjects.CodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null JCDCHelper.DBCodes.DataObjects.CodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null
Scoped as: PerRequest
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ISpamisCodeDAL (JCDCHelper.DBCodes.Interfaces.ISpamisCodeDAL) JCDCHelper.DBCodes.DataObjects.SpamisCodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null JCDCHelper.DBCodes.DataObjects.SpamisCodeDAL, JCDCHelper.DBCodes, Version=3.1.2.2, Culture=neutral, PublicKeyToken=null
Scoped as: PerRequest
....
and #2:
ObjectFactory.AssertConfigurationIsValid();
Looks for obvious errors and gives you better information to fix them... are you haunted by the words "Or one of it's dependencies" this is the tool for you.
Give them a try... Not magic bullets, but a huge help.
Good luck
Cal-
Wednesday, May 15, 2013
RDLC Repeating Headers on each page.
When you check the repeat headers on each page in an RDLC report
the headers don't actually repeat.
To fix this follow the steps here:
http://bidn.com/blogs/SMcDonald/bidn-blog/1696/scrolling-column-headers-static-header-columns
the headers don't actually repeat.
To fix this follow the steps here:
http://bidn.com/blogs/SMcDonald/bidn-blog/1696/scrolling-column-headers-static-header-columns
Subscribe to:
Posts (Atom)