So Inversion Of Control is an undefined description, so Dependency Injection has become a new definition. This is a very, very powerful solution and, quite possibly, also confuses someone who has never encountered this.
So in my search, so as not to be a deer in the headlights, I read. I found some awesome books and online posts. But, like all wonderful things, more questions arose than answers.
A problem that absorbs variables from an unknown project that will be implemented after they are implemented in my project.
Decision:
public interface ISiteParameter
{
Guid CustomerId { get; set; }
string FirstName { get; set; }
string LastName { get; set; }
string Phone { get; set; }
}
My injector:
public interface IInjectSiteParameter
{
void InjectSite(ISiteParameter dependant);
}
Then I created this:
public class SiteContent : IInjectSiteParameter
{
private ISiteParameter _dependent;
#region Interface Member:
public void InjectSite(ISiteParameter dependant)
{
_dependant = dependant;
}
#endregion
}
Then, to implement it using the Shared Reference for Fed Variables, I created a class that will be implemented as follows:
public class SiteParameters : ISiteParameter
{
public Guid Customer Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Phone { get; set; }
}
SiteParameters Class ; , :
ISiteParameter i = new ISiteParameter();
MessageBox.Show(i.Guid + i.FirstName + i.LastName + i.Phone);
, , ... ?
? , , , , ?
?