So I have this data class:
public class RecentProject
{
public string ProjectName { get; set; }
public string ProjectPath { get; set; }
public DateTime CreationDate { get; set; }
public string OutputFolder { set; get; } = "";
}
It just defines the properties of the recent project, and I wanted to apply dependency inversion so I extracted an interface from the class:
public interface IRecentProject
{
DateTime CreationDate { get; set; }
string OutputFolder { get; set; }
string ProjectName { get; set; }
string ProjectPath { get; set; }
}
then I made an ioc container(inversion of control) and registered the class type as the interface:
Mvx.IoCProvider.RegisterType<IRecentProject, RecentProject>();
so anywhere in my app when I want to create a recent project I just use:
Mvx.IoCProvider.Resolve<IRecentProject>();
but after I did this I ran into some problems that would be hard to solve with the current setup so I thought that maybe this is not the correct way to apply dependency inversion in this class because none of the dependency inversion benefits would apply like:
- unit testing: as I will not be unit testing a data class
- The ability to change the class implementation: as any changes in the class will require a change in the interface to be able to use the new features added
So what should I do, I have searched a lot on this topic and could not find a clear answer,
please help and thanks in advance.