Пример #1
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="objectType">The type of the object being loaded</param>
        /// <param name="loadContext">The LoadContext for the load.</param>
        /// <param name="innerException">The original exception which caused the failure.</param>
        public LoadRequestFailedException(Type objectType, LoadContext loadContext, Exception innerException)
            : base("An error occurred loading an object of type " + objectType.Name + ", see InnerException for details.", innerException)
        {
            if (objectType == null) throw new ArgumentNullException();
             if (loadContext == null) throw new ArgumentNullException();

             ObjectType = objectType;
             LoadContext = loadContext;
        }
Пример #2
0
        /// <summary>
        /// Set up all the handlers for this CacheEntry
        /// </summary>
        /// <param name="objectType"></param>
        /// <param name="context"></param>
        /// <param name="proxyCallback">callback that should be invoked when update is finished</param>
        public CacheEntry(LoadContext context, Type objectType, Action<CacheEntry> proxyCallback)
        {
            _proxyComplitionCallback = proxyCallback;
             LoadContext = context;
             ObjectType = objectType;

             _stats = new EntryStats(this);

             // set up our value loaders.
             //
             _cacheLoader = new CacheValueLoader(this);
             _cacheLoader.Loading += ValueLoader_Loading;
             _cacheLoader.ValueAvailable += Cached_ValueAvailable;
             _cacheLoader.LoadFailed += CacheLoader_Failed;

             _liveLoader = new LiveValueLoader(this);
             _liveLoader.Loading += ValueLoader_Loading;
             _liveLoader.ValueAvailable += Live_ValueAvailable;
             _liveLoader.LoadFailed += LiveValueLoader_Failed;

             NextCompletedAction = new UpdateCompletionHandler(this);
        }
Пример #3
0
 /// <summary>
 /// protected ctor.
 /// </summary>
 /// <param name="loadContext"></param>
 protected LoadRequest(LoadContext loadContext)
 {
     this.LoadContext = loadContext;
 }
Пример #4
0
        /// <summary>
        /// Updates the live value from  an inentional DataManager.Save operation.
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="loadContext"></param>
        internal void UpdateValue(object instance, LoadContext loadContext)
        {
            UpdateExpiration(DateTime.Now, instance as ICachedItem);

             LoadContext = loadContext;
             if (_valueReference != null && _valueReference.IsAlive)
             {
            UpdateFrom(null, instance);
             }
             else
             {
            ValueInternal = instance;
             }
        }
Пример #5
0
 internal static string BuildUniqueName(Type objectType, LoadContext context)
 {
     return string.Format("{0}_{1}", objectType.Name, context.UniqueKey);
 }
Пример #6
0
 public CacheEntry(LoadContext context, Type objectType, Type loaderObjectType, Action<CacheEntry> proxyCallback)
     : this(context, objectType, proxyCallback)
 {
     LoaderObjectType = loaderObjectType;
 }
Пример #7
0
 /// <summary>
 /// Create a WebLoadRequest
 /// </summary>
 /// <param name="loadContext"></param>
 /// <param name="uri">The URI to request</param>
 /// <param name="method">The method to request - GET or POST</param>
 /// <param name="data">The data for a POST request</param>
 public WebLoadRequest(LoadContext loadContext, Uri uri, string method, string data)
     : this(loadContext, uri)
 {
     Method = method;
      Data = data;
 }
Пример #8
0
 /// <summary>
 /// Create a WebLoadRequest
 /// </summary>
 /// <param name="loadContext"></param>
 /// <param name="uri"></param>
 public WebLoadRequest(LoadContext loadContext, Uri uri)
     : base(loadContext)
 {
     Uri = uri;
      Method = "GET";
 }