Thursday, November 3, 2011

NHibernate.MappingException: No persister for Fluent

if you get this in Jcdc

NHibernate.MappingException: No persister for

First check to be sure your EO And MAP are both public.
Also look for a spelling error in you MAP file
Verify the namespaces are correct.
Make sure you have 1 Eo to each EOMap

If your EO is in JcdcHelper, or some other assembly here is the issue

jcdcFactory.BuildFactoryByConfigFile( "~/JcdcDb.config" );

ONLY loads from the assembly of Student EO and EOMAP which is ususally YOUR apps assembly.

Here are the guts

public void BuildFactoryByConfigFile(string rawFilePathToGetMapPath)
{
// Build local fluentConfig
NHibernate.Cfg.Configuration localConfiguration = new NHibernate.Cfg.Configuration();
localConfiguration = localConfiguration.Configure(GetMapPath(rawFilePathToGetMapPath));
FluentConfiguration localFluent = Fluently.Configure(localConfiguration);
localFluent.Mappings(
m =>
{
// this step scans your assembly for EO and maps in Cis3G
// you would have to add two more lines to scan
// your JCDCHelper EO and Maps

m.HbmMappings.AddFromAssemblyOf();
m.FluentMappings.AddFromAssemblyOf()
.AddFromAssemblyOf();
}
)
.ExposeConfiguration(
cfg =>
{
cfg.SetListener(ListenerType.PreInsert, new AuditEventListener());
cfg.SetListener(ListenerType.PreUpdate, new AuditEventListener());
}
);
// build session from FluentConfiguration
localFactory = localFluent.BuildSessionFactory();

}


As you can see you woudl need to make your own copy and modify
these lines

m.HbmMappings.AddFromAssemblyOf();
m.FluentMappings.AddFromAssemblyOf()
.AddFromAssemblyOf();


to call from JcdcHelper.EO and .EOMap as well, (or whatever assembly you are using)

Thursday, September 1, 2011

StackOverflow



God I love stack overflow for Programming problems.

Just felt the need to put that out there, if you're not using it,
and you're a programmer. Start.

Tuesday, August 16, 2011

Converting to IIs 7, MVC 3 issues


I’m currently working on IIS7 for the Student Portal Project, if and when you move to it, here are a couple important issues of which to be aware.

Elmah & iis7
http://groups.google.com/group/elmah/browse_thread/thread/4bbef2f26e0c5fd1

First Request Initialization and IIS 7 with integrated mode.
http://mvolo.com/blogs/serverside/archive/2007/11/10/Integrated-mode-Request-is-not-available-in-this-context-in-Application_5F00_Start.aspx

So far these are the only big issues. Both of which have workarounds addressed in the links above.

Thursday, May 5, 2011

VS2010 opens encoding popup everytime it opens a file

vs 2010 is popping up the encoding popup everytim a file opens, very annoying

found the fix here:

http://social.msdn.microsoft.com/Forums/en-US/vseditor/thread/97450689-c9e6-4562-a504-e2fdc803ec50/?prof=required

I had the "With encoding" editor selected as default, changed it to not "with encoding version of the editor as default and the issue went away.

Eric-

Tuesday, April 26, 2011

Structure map errors and their causes in Jcdc



Here is a cheat sheet I made of common Structure map errors, and all the different ways I've caused them.


Enjoy


Eric-


StructureMap Exception Code: 200 Could not find an Instance named "JCDC" for PluginType POCAdmin3G.DAL.Interfaces.ISessionManager

Answer: bootstrapper is not loading type, if it’s a session manager like above, check that the z.OfConcretetype stuff is loaded.
 
Check the bootstrap structure map file.
If that passes, check the connection to the DB

NHibernate.Cfg.HibernateConfigException: An exception occurred during configuration of persistence layer.

Answer:Probably can’t find the jcdcdbconifg.xml file, check the inner exception


 


 
StructureMap Exception Code: 202 - No D
efault Instance defined for PluginFamily JCDCHelper.Utilities.Interfaces.INetLog, JCDCHelper.Utilities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Answers:


1.      Make sure it's scanning the assembly that contains the object you can't load:
x.Scan( y =>
{
y.Assembly(Assembly.GetAssembly(typeof(IWebAccess))); // JcdcHelper Utilities
y.Assembly(Assembly.GetAssembly(typeof(IUserMaintBLL))); // JcdcHelper.BLL
y.Assembly(Assembly.GetAssembly(typeof(IUserMaintDAL))); // JcdcHelper.DAL
y.Assembly(Assembly.GetAssembly(typeof(ICallDB))); // JcdcHelper.DALAccess
y.Assembly(Assembly.GetAssembly(typeof(ICenterDAL))); // CIS3G DAL
y.WithDefaultConventions();
});.

2.      Use objectFactory.WhatDoIHave() to see if the offending assembly is loaded or not.

3.      Check to make sure the spelling of the Concrete type is EXACTLY like the interface type, except for the 'I' at the beginning. For example IBobBLL and IBobBll will not
load. by default it only loads if the spelling of the name it exact. for other options to fix this issue, see this link:
http://stackoverflow.com/questions/1946228/structuremap-error-202-setting-up-ioc-container

4.      Check to be sure that resharper did not bind you to the incorrect name space, some BLLS exists in 2 places (JCDC.* And JcdcHelper.*)

5.      Make sure Interface is public Concrete class is public Double check namespaces for concrete and interface.

6.      Check that it's not a base object throwing the exception in one of the the paramters passed into the constructor of the BLL/DAL (passDal, PasssBll, etc)

Remove the Class from the passed in parameters, and do a ObjectFactory.GetInstance instead, it'll step into the constructor and blow on the new call to GetInstance.
You can debug it from there...
         Examples:
         Say the 202 error is on IInterface1, which is beign passed in as a constructor  parameter.
         StructureMap is Bad about returning the 202 error on the first parameter, even if its     
         actually from a later parameter... so


          Class(IInterface1 _i1, IInterface2 _i2, IInterface3 _i3)
          {}


         to


          Class(IInterface2 _i2, IInterface3 _i3)
          {
               IIntercafe1 _i1 = ObjectFactory.GetInstance<IInterface1>();
          }
        or
           Class(IInterface1 _i1, IInterface2 _i2, IInterface3 _i3): base(_il1)
          {}
        to
           Class(IInterface2 _i2, IInterface3 _i3): base(ObjectFactory.GetInstance<IInterface1>())
          {}

         Will help you figure out which it is...
   OR you can step into the constructor of IInterface1 on the ObjectFactory line, and see if   
         one of it's dependencies is the issue (sometimes you'll dig down , down, down before you
         get it...)

see comments below.


7.      Edit JCDCHelper, make INetlog lazy load, or comment it out, eventually you’ll unhide a
more descriptive error, if it’s caused by a reference miss match (ie FluentNhibernte from the bin instead of _CommonDlls.)

8.      Don't forget to inherit from the interface
1.      public class StudentBLL : IStudentBLL 
2.      public class StudentBLL : BaseBLL,  IStudentBLL

9.      Try explicit loading instead of convention based, see if it gives you meanign ful errors
1.      x.For<IStudentBLL>().Use<StudentBLL>();

10.  Make sure your BLL looks like this
[System.ComponentModel.DataObject]
public class ProcessingWrapperBLL : BaseBLL, IProcessingWrapperBLL
{

     include the follwing
     1. [...DataObject]
     2. Public class
     3. Derived from BaseBll
    4. Inherit from the matching Interface IProcessignWrapperBLL


StructureMap Exception Code: 180: No public construcotr defined.

Make sure it's Building the assembly that contains the object, not it's Interfacex.BuildInstancesOf<ITicketHelper>()
.TheDefaultIsConcreteType<
TicketHelperWinform>()//<-- if this is an interface you get the error.CacheBy(
InstanceScope.Hybrid );
:




=======================================================================
Structure map 3 errors



170

no default instalce of Class xx


in assertconfig is valid, it puke if you do ObjectFacory.GetInstance<xxx>, in the only construcutre of a class or up in the clas header outside the constructor... make another constructor that passes in the instances, SM will use that, and you're golden

Nhibernate update followed by Response.Redirect causes ThreadAbortException

Response.Redirect causes the response thread to end ungracefully, call the version
Response.Redirect(String url, bool endResponse) with the endResponse = false to close it gently.

http://support.microsoft.com/kb/312629

Thursday, February 17, 2011

live@edu "you are being redirected to the Virtual Host"

When redirecting to live@edu we get the error "you are being redirected to the Virtual Host"

We think it is bluecoat, we're addign bluecoat exceptions,  if it does not work i'll come back and add more info.

Tuesday, January 18, 2011

Transfer students

I learned today that my understanding of nttransfers was radically flawed.

each transfer adds a new record to the Enrollment type table, but no Sepertion was added.
Thus searching for the seperations for the transferes didn't work at all... It works better now that
is fixed and sep date is not used to filter out old results (as it was often null)