Пример #1
0
        /// <summary>
        /// 实体查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="queryRequest"></param>
        /// <returns></returns>
        public virtual T[] QueryEntity <T>(Bzure.Common.Data.EntityQueryRequest <T> queryRequest) where T : Bzure.Common.Core.IEntity, Bzure.Common.Core.IPersistenceState
        {
            lock (_queryHandlers)
            {
                InitEntityMap(typeof(T));

                Delegate handler;
                if (_queryHandlers.TryGetValue(typeof(T), out handler))
                {
                    QueryEntityHandler <T> h = handler as QueryEntityHandler <T>;
                    return(h(this, queryRequest));
                }
            }
            return(default(T[]));
        }
Пример #2
0
 void AppendEntityQueryHandler <T>(QueryEntityHandler <T> handler) where T : Bzure.Common.Core.IEntity
 {
     _queryHandlers[typeof(T)] = handler;
 }