Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Interface mapping #8171

Closed
darkengines opened this issue Apr 14, 2017 · 1 comment
Closed

[Feature] Interface mapping #8171

darkengines opened this issue Apr 14, 2017 · 1 comment

Comments

@darkengines
Copy link

Apart from having to request several tables (according to the used strategy), what is the real difficulty with this feature?

The absence of this functionality forces people to use abstract classes where an interface would have been desirable and sufficient, take the following example:

public class Feature {
		public int Id { get; set; }
		public string Title { get; set; }
		public string Description { get; set; }
	}
	public class Issue {
		public int Id { get; set; }
		public string Title { get; set; }
		public string Description { get; set; }
		public int Severity { get; set; }
	}
	public interface IFeatureProvider {
		ICollection<Feature> Features { get; }
	}
	public interface IIssueProvider {
		ICollection<Issue> Issues { get; }
	}
	public interface ICoffeeDrinker {
		string FavoriteCoffe { get; }
	}
	public class EntityFrameworkUser : IFeatureProvider, IIssueProvider {
		public EntityFrameworkUser() {
			Issues = new Collection<Issue>();
			Features = new Collection<Feature>();
		}
		public ICollection<Issue> Issues { get;}
		public ICollection<Feature> Features { get; }
	}
	public class EntityFrameworkDeveloper : IFeatureProvider, ICoffeeDrinker {
		public EntityFrameworkDeveloper() {
			Features = new Collection<Feature>();
		}
		public ICollection<Feature> Features { get; }
		public string FavoriteCoffe { get; }
	}
	public class FeatureProviderOwner {
		public FeatureProviderOwner() {
			FeatureProviders = new Collection<IFeatureProvider>();
		}
		public ICollection<IFeatureProvider> FeatureProviders { get; }
	}
	public class CoffeeDrinkerOwner {
		public CoffeeDrinkerOwner() {
			CoffeeDrinkers = new Collection<ICoffeeDrinker>();
		}
		public ICollection<ICoffeeDrinker> CoffeeDrinkers { get; }
	}

The lack of this feature leads developers to create whimsical classes like "CoffeeDrinkerFeatureProvider"

Is there anything planned on this? For the Core 2.0 version?
Any information on this topic is welcome.

Best regards,
Florent.

@ajcvickers
Copy link
Member

@darkengines This is being tracked by #757. There isn't any fundamental difficulty here, although two things to consider:

  • Make the resolution of concrete types flexible enough that it could be performed by an IoC container
  • Ensure that polymorphic associations are allowed

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants