Skip to content
Browse files

goto removed

linq simplified
  • Loading branch information...
1 parent e6b3e51 commit adda2257048f6e1a1eeb1615f55adad89dfa58fd @akurdyukov committed Sep 9, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/Castle.Facilities.NHibernate/NHibernateFacility.cs
View
17 src/Castle.Facilities.NHibernate/NHibernateFacility.cs
@@ -168,7 +168,7 @@ protected override void Init()
if (count == 0 || count > 1)
throw new FacilityException("no INHibernateInstaller has IsDefault = true or many have specified it");
- if (!installers.All(x => !string.IsNullOrEmpty(x.SessionFactoryKey)))
+ if (installers.Any(x => string.IsNullOrEmpty(x.SessionFactoryKey)))
throw new FacilityException("all session factory keys must be non null and non empty strings");
VerifyLegacyInterceptors();
@@ -282,27 +282,28 @@ private ComponentRegistration<T> GetLifeStyle<T>(ComponentRegistration<T> regist
return registration.Named(baseName + SessionPWRSuffix).LifeStyle.PerWebRequest;
if (index == 2)
return registration.Named(baseName + SessionTransientSuffix).LifeStyle.Transient;
- goto default; // TODO: kill this goto
+ break;
case DefaultSessionLifeStyleOption.SessionPerWebRequest:
if (index == 0)
return registration.Named(baseName + SessionPWRSuffix).LifeStyle.PerWebRequest;
if (index == 1)
return registration.Named(baseName + SessionPerTxSuffix).LifeStyle.PerTopTransaction();
if (index == 2)
return registration.Named(baseName + SessionTransientSuffix).LifeStyle.Transient;
- goto default;
- case DefaultSessionLifeStyleOption.SessionTransient:
+ break;
+ case DefaultSessionLifeStyleOption.SessionTransient:
if (index == 0)
return registration.Named(baseName + SessionTransientSuffix).LifeStyle.Transient;
if (index == 1)
return registration.Named(baseName + SessionPerTxSuffix).LifeStyle.PerTopTransaction();
if (index == 2)
return registration.Named(baseName + SessionPWRSuffix).LifeStyle.PerWebRequest;
- goto default;
- default:
- throw new FacilityException("invalid index passed to GetLifeStyle<T> - please file a bug report");
+ break;
+ default:
+ throw new FacilityException("Unknown default life style - please file a bug report");
}
- }
+ throw new FacilityException("Invalid index passed to GetLifeStyle<T> - please file a bug report");
+ }
private class Data
{

1 comment on commit adda225

@haf
haf commented on adda225 Sep 9, 2012

I think you are mixing tabs and spaces, making it hard to see the changes -- could you make an addative commit that normalizes spaces?

Please sign in to comment.
Something went wrong with that request. Please try again.