Hi,
If I have a service definition/implementation like this:
using System;
using System.ServiceModel;
namespace aspace.service
{
[ServiceContract(Namespace = "http://aspace.service")]
public interface IUpdate
{
[OperationContract]
ConfirmationMessage UpdatePerson(string PersonIdentifier);
}
}
public class UpdateService : IUpdate
{
public ConfirmationMessage UpdatePerson(string PersonIdentifier)
{
// some implementation here
}
}
I can create a servicehost like this:
ServiceHost host = new ServiceHost(typeof(UpdateService), someEndpointAddress);
Then, after creating a binding and adding metadatabehavior, I can open the host. Which will, upon a request from a client, call UpdatePerson(aPersonIdentifier).
I would like to talk to a database from UpdatePerson. Answers to a previous question of mine suggest I should use dependency injection for this sort of thing.
The problem is that I never create an instance of the class UpdateService. So how can I inject a dependency? How would you solve this?
Thanks, regards, Miel.