Context
From review discussion on PR #22 (docs PR):
#22 (comment)
Declaring an entity is not necessary, the simplest version is
var entity = new Entity<Identity>(repository, new Table<Identity>("I"));
Why would one want to declare the IdentityEntity? To avoid using complicated type names such as Entity<Identity, IdentityFilter, DbQueryOptions> all over the place when things get extended. The more complicated version should be noted in the usage.md with the reasons.
We need a task to further simplify this to Entity<Identity>(repository, string tableName), as well.
Task
Add a further-simplified Entity<TModel> constructor overload that takes a plain
string tableName instead of requiring the caller to construct a Table<TModel>
themselves, e.g.:
var entity = new Entity<Identity>(repository, "I");
This should be equivalent to today's:
var entity = new Entity<Identity>(repository, new Table<Identity>("I"));
i.e. internally construct the Table<TModel> from the given table name so callers
don't need to know about Table<T> for the common case.
Acceptance criteria
Closes/relates to the docs feedback in PR #22.
Context
From review discussion on PR #22 (docs PR):
#22 (comment)
Task
Add a further-simplified
Entity<TModel>constructor overload that takes a plainstring tableNameinstead of requiring the caller to construct aTable<TModel>themselves, e.g.:
This should be equivalent to today's:
i.e. internally construct the
Table<TModel>from the given table name so callersdon't need to know about
Table<T>for the common case.Acceptance criteria
Entity<TModel>(and/or the appropriate baseEntity<TModel, TFilter, TOptions>constructor chain) accepting(repository, string tableName).(repository, Table<TModel>)constructor remains available for casesneeding more control (custom schema, quoting, etc.).
docs/USAGE.md(and README quick start if applicable) to show thesimplest form first, and note the
Table<T>overload as the "more complicatedversion" for advanced cases, per the reasoning in the linked review comment.
Closes/relates to the docs feedback in PR #22.