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;
> >             }
> >             return true;
> >         }
> >         /*
> >          * This method check whether the username/system ID and
> > password match together for a user!
> >          */
> >         public override bool ValidateUser(string usernameAndSystemId,
> > string password)
> >         {
> >             string[] temp = usernameAndSystemId.Split('|');
> >             string username = temp[0];
> >             int systemId;
> >             if (!String.IsNullOrEmpty(temp[1]) && int.TryParse(temp
> > [1], out systemId) && !String.IsNullOrEmpty(username))
> >             {
> >                 OnlineSystem system =
> > this.service.getCustomerInfoByName(username);
> >                 if (system == null) return false;
> >
> >                 if (!CheckPassword(password, system.Password) ||
> > system.SS20Id != systemId) return false;
> >
> >                 return true;
> >             }
> >             else
> >             {
> >                 return false;
> >             }
> >         }
> >
> >         /*
> >          * Since the login process need username and system id GetUser
> > should be overrde!
> >          * if user is online the information should be pass otherwise
> > not.
> >          */
> >         public override MembershipUser GetUser(string username, bool
> > userIsOnline)
> >         {
> >             MembershipUser user = null;
> >
> >             if (!String.IsNullOrEmpty(username) && userIsOnline)
> >             {
> >                 OnlineSystem system =
> > this.service.getCustomerInfoByName(username);
> >                 if (system != null)
> >                 {
> >                     user = new MonitorUser(this.Name,
> >                                         system.LoginName,
> >                                         system.SS20Id,
> >                                         string.Empty,
> > ...
> >
> > 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.

Reply via email to