Another way of avoiding "these kind of hidden costs" is to have a unit test that verifies that nhibernate can be initialized, including parsing of all mapping files etc. Optionally, I also like to have the test output the nhibernate generated schema to standard output.
With that test you would have gotten the error message with the true message, instead of it being hidden by some other parser. /Oskar 2010/1/12 Sheri <[email protected]>: > What do you recommend instead? something more clear and fast? > > > On 12 Jan, 10:52, Mohamed Meligy <[email protected]> wrote: >> This kind of hidden costs is what makes me although I like NHibernate pretty >> much not recommend it to my company and just use it in freelance projects, >> etc... :S >> >> Regards, >> >> -- >> Mohamed Meligy >> Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications) >> Injazat Data Systems >> P.O. Box: 8230 Abu Dhabi, UAE. >> >> Phone: +971 2 6992700 >> Direct: +971 2 4045385 >> Mobile: +971 50 2623624, +971 55 2017 621 >> >> E-mail: [email protected] >> Weblog:http://weblogs.asp.net/meligy >> >> >> >> On Tue, Jan 12, 2010 at 1:39 PM, Sheri <[email protected]> wrote: >> > the problem is solved >> >> > just a "virtual" keyword was missed for a property in an entity >> > class!!!!!!!!!! (the cost = 1,5 days... it is nice well) >> >> > On 12 Jan, 09:52, Sheri <[email protected]> wrote: >> > > Hi Mohammad! >> > > Thansk for you quick reply >> > > Yes I use custome membership provider. I use project model and I have >> > > created "ASP .NET MVC" project through its template (1.0). It is a >> > > local server, I have used the built in SQL Server in VS 2008. >> >> > > my wb.config for mentioned part (nhibernate and membership provider >> > > looks like so: >> >> > > _________________ Parts of web.config _________________ >> >> > > <configuration> >> >> > > <configSections> >> > > .... >> > > <section name="hibernate-configuration" >> > > type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" /> >> > > </configSections> >> >> > > <appSettings/> >> >> > > <connectionStrings> >> > > <add name="ApplicationServices" connectionString="data source=. >> > > \SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory| >> > > aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/ >> >> > > </connectionStrings> >> >> > > <system.web> >> > > ... >> > > <authentication mode="Forms"> >> > > <forms loginUrl="~/Account/LogOn" timeout="2880" /> >> > > </authentication> >> >> > > <membership defaultProvider="MonitorMembershipProvider"> >> > > <providers> >> > > <clear/> >> > > <add name="MonitorMembershipProvider" >> >> > type="WebMonitorUpdate.MembershipServicesImpl.SQLServerMembershipProvider" >> > > connectionStringName="" >> > > enablePasswordRetrieval="true" >> > > enablePasswordReset="true" >> > > requiresQuestionAndAnswer="false" >> > > requiresUniqueEmail="true" >> > > passwordFormat="Hashed" >> > > maxInvalidPasswordAttempts="5" >> > > minRequiredPasswordLength="6" >> > > minRequiredNonalphanumericCharacters="0" >> > > passwordAttemptWindow="10" >> > > passwordStrengthRegularExpression="" >> > > applicationName="/" >> > > /> >> > > </providers> >> > > </membership> >> >> > > <profile> >> > > <providers> >> > > <clear/> >> > > <add name="AspNetSqlProfileProvider" >> > > type="System.Web.Profile.SqlProfileProvider, System.Web, >> > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" >> > > connectionStringName="ApplicationServices" >> > > applicationName="/" >> > > /> >> > > </providers> >> > > </profile> >> >> > > <roleManager enabled="false"> >> > > <providers> >> > > <clear /> >> > > <add connectionStringName="ApplicationServices" >> > > applicationName="/" name="AspNetSqlRoleProvider" >> > > type="System.Web.Security.SqlRoleProvider, System.Web, >> > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> >> > > <add applicationName="/" name="AspNetWindowsTokenRoleProvider" >> > > type="System.Web.Security.WindowsTokenRoleProvider, System.Web, >> > > Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> >> > > </providers> >> > > </roleManager> >> >> > > ..... >> >> > > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> >> > > <session-factory name="WebMonitorUpdate"> >> > > <property >> >> > name="connection.provider">NHibernate.Connection.DriverConnectionProvider</ >> > > property> >> > > <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</ >> > > property> >> > > <property >> > > name="connection.driver_class">NHibernate.Driver.SqlClientDriver</ >> > > property> >> > > <property name="connection.connection_string">Data Source=. >> > > \SQLEXPRESS;AttachDbFilename=|DataDirectory| >> > > WebMonitorUpdate.mdf;Integrated Security=True;User Instance=True</ >> > > property> >> > > <property >> >> > name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFac >> > tory, >> > > NHibernate.ByteCode.LinFu</property> >> > > <mapping assembly ="WebMonitorUpdate" /> >> > > </session-factory> >> > > </hibernate-configuration> >> > > </configuration> >> > > ___________________________________________________ >> >> > > Here is the code for my membership provider: >> >> > > _________________ MEMBERSHIP PROVIDER _________________ >> >> > > public sealed class SQLServerMembershipProvider : >> > > MembershipProvider >> > > { >> > > private OnlineSystemService service = null; >> >> > > private string applicationName; >> > > private int maxInvalidPasswordAttempts; >> > > private int passwordAttemptWindow; >> > > private int minRequiredNonAlphanumericCharacters; >> > > private int minRequiredPasswordLength; >> > > private string passwordStrengthRegularExpression; >> > > private bool enablePasswordReset; >> > > private bool enablePasswordRetrieval; >> > > private bool requiresQuestionAndAnswer; >> > > private bool requiresUniqueEmail; >> >> > > #region Settings >> >> > > public override string ApplicationName >> > > { >> > > get { return this.applicationName; } >> > > set { this.applicationName = value; } >> > > } >> >> > > public override int MaxInvalidPasswordAttempts { get { return >> > > this.maxInvalidPasswordAttempts; } } >> > > public override int PasswordAttemptWindow { get { return >> > > this.passwordAttemptWindow; } } >> > > public override int MinRequiredNonAlphanumericCharacters { get >> > > { return this.minRequiredNonAlphanumericCharacters; } } >> > > public override int MinRequiredPasswordLength { get { return >> > > this.minRequiredPasswordLength; } } >> > > public override string PasswordStrengthRegularExpression { get >> > > { return this.passwordStrengthRegularExpression; } } >> > > public override bool EnablePasswordReset { get { return >> > > this.enablePasswordReset; } } >> > > public override bool EnablePasswordRetrieval { get { return >> > > false; } } >> > > public override bool RequiresQuestionAndAnswer { get { return >> > > this.requiresQuestionAndAnswer; } } >> > > public override bool RequiresUniqueEmail { get { return >> > > this.requiresUniqueEmail; } } >> > > public override MembershipPasswordFormat PasswordFormat >> > > { >> > > get { return MembershipPasswordFormat.Hashed; } >> > > } >> >> > > #endregion >> >> > > public SQLServerMembershipProvider(): this(null) >> > > { >> > > } >> >> > > public SQLServerMembershipProvider(OnlineSystemService >> > > service) >> > > { >> > > this.service = service ?? new OnlineSystemService(); >> > > } >> >> > > public override void Initialize(string name, >> > > NameValueCollection config) >> > > { >> > > base.Initialize(name, config); >> >> > > this.ApplicationName = GetConfigValue(config >> > > ["applicationName"], >> >> > > System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); >> > > this.maxInvalidPasswordAttempts = Convert.ToInt32 >> > > (GetConfigValue(config["maxInvalidPasswordAttempts"], "5")); >> > > this.passwordAttemptWindow = Convert.ToInt32(GetConfigValue >> > > (config["passwordAttemptWindow"], "10")); >> > > this.minRequiredNonAlphanumericCharacters = Convert.ToInt32 >> > > (GetConfigValue(config["minRequiredNonAlphanumericCharacters"], "1")); >> > > this.minRequiredPasswordLength = Convert.ToInt32 >> > > (GetConfigValue(config["minRequiredPasswordLength"], "7")); >> > > this.passwordStrengthRegularExpression = Convert.ToString >> > > (GetConfigValue(config["passwordStrengthRegularExpression"], >> > > string.Empty)); >> > > this.enablePasswordReset = Convert.ToBoolean(GetConfigValue >> > > (config["enablePasswordReset"], "true")); >> > > this.enablePasswordRetrieval = Convert.ToBoolean >> > > (GetConfigValue(config["enablePasswordRetrieval"], "true")); >> > > this.requiresQuestionAndAnswer = Convert.ToBoolean >> > > (GetConfigValue(config["requiresQuestionAndAnswer"], "false")); >> > > this.requiresUniqueEmail = Convert.ToBoolean(GetConfigValue >> > > (config["requiresUniqueEmail"], "true")); >> > > } >> >> > > public override bool ChangePassword(string username, string >> > > oldPassword, string newPassword) >> > > { >> >> > > //username and systemId1 are splited by | >> > > if (!String.IsNullOrEmpty(username)) >> > > { >> > > OnlineSystem system = >> > > this.service.getCustomerInfoByName(username); >> > > if (system == null) return false; >> >> > > if (!CheckPassword(oldPassword, system.Password)) >> > > return false; >> >> > > ValidatePasswordEventArgs args = new >> > > ValidatePasswordEventArgs(username, newPassword, false); >> > > OnValidatingPassword(args); >> > > if (args.Cancel) >> > > { >> > > if (args.FailureInformation != null) >> > > throw args.FailureInformation; >> > > else >> > > throw new MembershipPasswordException("Change >> > > password canceled due to new password validation failure."); >> > > } >> > > system.Password = HashPassword(newPassword); >> > > service.SystemDAO.commitTransaction(); >> > > } >> > > else >> > > { >> > > return false; >> >> ... >> >> läs mer » > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > > >
-- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
