Exemple #1
0
            /// <summary>
            /// Called when an InstanceContext object recycles a service object.
            /// </summary>
            /// <param name="instanceContext">The service's instance context.</param>
            /// <param name="instance">The service object to be recycled.</param>
            public void ReleaseInstance(InstanceContext instanceContext, object instance)
            {
                DomainDataServiceInstanceInfo instanceInfo = (DomainDataServiceInstanceInfo)instance;

                if (instanceInfo.DomainServiceInstance != null)
                {
                    DomainService.Factory.ReleaseDomainService(instanceInfo.DomainServiceInstance);
                }
            }
Exemple #2
0
            /// <summary>
            /// Returns a service object given the specified InstanceContext object.
            /// </summary>
            /// <param name="instanceContext">The current InstanceContext object.</param>
            /// <param name="message">The message that triggered the creation of a service object.</param>
            /// <returns>The service object.</returns>
            public object GetInstance(InstanceContext instanceContext, Message message)
            {
                Debug.Assert(instanceContext != null, "instanceContext should not be null.");

                DomainDataServiceInstanceInfo instanceInfo = new DomainDataServiceInstanceInfo();

                instanceInfo.DomainServiceType = instanceContext.Host.Description.ServiceType;

                // Since we require more contextual information at the point in time when a
                // DomainService is created, we return an info object and do delay instantiation
                // (the invoker will call back into us later to do instantiation).
                return(instanceInfo);
            }
            /// <summary>
            /// Returns a service object given the specified InstanceContext object.
            /// </summary>
            /// <param name="instanceContext">The current InstanceContext object.</param>
            /// <param name="message">The message that triggered the creation of a service object.</param>
            /// <returns>The service object.</returns>
            public object GetInstance(InstanceContext instanceContext, Message message)
            {
                Debug.Assert(instanceContext != null, "instanceContext should not be null.");

                DomainDataServiceInstanceInfo instanceInfo = new DomainDataServiceInstanceInfo();
                instanceInfo.DomainServiceType = instanceContext.Host.Description.ServiceType;

                // Since we require more contextual information at the point in time when a 
                // DomainService is created, we return an info object and do delay instantiation 
                // (the invoker will call back into us later to do instantiation).
                return instanceInfo;
            }