Exemplo n.º 1
0
        /// <summary>
        /// Returns a generated object.
        /// </summary>
        /// <returns></returns>
        protected ISqlWrapperBase GetWrapped()
        {
            MethodInfo      mi  = (MethodInfo)(new StackTrace().GetFrame(1).GetMethod());
            ISqlWrapperBase res = (ISqlWrapperBase)m_swTypes[mi.Name];

            if (res == null)
            {
                throw new SqlWrapperException("The object is not initialized.");
            }
            return(res);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Generates all wrapped objects mention in public properties
 /// and derived from <see cref="ISqlWrapperBase"/> interface.
 /// </summary>
 private void GenerateAllWrapped()
 {
     MethodInfo[] mis = this.GetType().GetMethods();
     for (int i = 0; i < mis.Length; ++i)
     {
         Type type = mis[i].ReturnType;
         if (type.GetInterface(typeof(ISqlWrapperBase).FullName) == typeof(ISqlWrapperBase))
         {
             if (mis[i].Name.StartsWith("get_"))
             {
                 if (!m_swTypes.ContainsKey(mis[i].Name))
                 {
                     ISqlWrapperBase sw = WrapFactory.Create(type);
                     m_swTypes[mis[i].Name] = sw;
                 }
             }
         }
     }
 }
 /// <summary>
 /// Update values of a wrapped object.
 /// </summary>
 /// <param name="wrapped">A wrapped object.</param>
 protected virtual void UpdateWrapped(ISqlWrapperBase wrapped)
 {
     wrapped.Connection = m_connection;
     wrapped.Transaction = m_transaction;
     wrapped.AutoCloseConnection = m_autoCloseConnection;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Update values of a wrapped object.
 /// </summary>
 /// <param name="wrapped">A wrapped object.</param>
 protected virtual void UpdateWrapped(ISqlWrapperBase wrapped)
 {
     wrapped.Connection          = m_connection;
     wrapped.Transaction         = m_transaction;
     wrapped.AutoCloseConnection = m_autoCloseConnection;
 }