protected static LockMode ConvertFrom(Enums.LockMode lockMode)
        {
            var translatedLockMode = typeof(LockMode).GetField(
                lockMode.ToString(), BindingFlags.Public | BindingFlags.Static);

            return((LockMode)translatedLockMode.GetValue(null));
        }
示例#2
0
        /// <summary>
        ///     Translates a domain layer lock mode into an NHibernate lock mode via reflection.  This is
        ///     provided to facilitate developing the domain layer without a direct dependency on the
        ///     NHibernate assembly.
        /// </summary>
        private static LockMode ConvertFrom(Enums.LockMode lockMode)
        {
            FieldInfo translatedLockMode = typeof(LockMode).GetField(lockMode.ToString(), BindingFlags.Public | BindingFlags.Static);

            Check.Ensure(translatedLockMode != null, "The provided lock mode , '" + lockMode + ",' " + "could not be translated into an NHibernate.LockMode. This is probably because " + "NHibernate was updated and now has different lock modes which are out of synch " + "with the lock modes maintained in the domain layer.");

            return((LockMode)translatedLockMode.GetValue(null));
        }
示例#3
0
        /// <summary>
        /// Translates a domain layer lock mode into an NHibernate lock mode via reflection.  This is
        /// provided to facilitate developing the domain layer without a direct dependency on the
        /// NHibernate assembly.
        /// </summary>
        protected LockMode ConvertFrom(Enums.LockMode lockMode)
        {
            FieldInfo translatedLockMode = typeof(LockMode).GetField(lockMode.ToString(),
                                                                     BindingFlags.Public | BindingFlags.Static);

            if (translatedLockMode == null)
            {
                throw new InvalidCastException(
                          "The provided lock mode , '" + lockMode + ",' " +
                          "could not be translated into an NHibernate.LockMode. This is probably because " +
                          "NHibernate was updated and now has different lock modes which are out of synch " +
                          "with the lock modes maintained in the domain layer.");
            }

            return((LockMode)translatedLockMode.GetValue(null));
        }