Add Support for Selecting from a Table by Its Name
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by locating the existing From() entry point in the C# client and trace how the model's Table attribute is resolved. Add the requested table-name overload so callers can select a table at runtime, then verify that Get() reads from the supplied table rather than the attribute-defined table.
Written by the indexing model from the issue text.
Description
Feature request : Add Overload to Select Table by Name
Is your feature request related to a problem? Please describe.
Currently, when working with the ProductModel class, the table name is specified using the [Table] attribute, e.g., [Table("coffeeteatable")]. This approach is static and requires the table name to be hardcoded in the attribute, making it less flexible for scenarios where the table name needs to be determined dynamically at runtime.
For instance, this method works as follows:
var products = await client.From<ProductModel>().Get();
But it does not allow specifying the table name dynamically, like this:
var products = await client.From<ProductModel>("my_table_name").Get();
Describe the solution you'd like
Introduce a new overload for the From method that accepts a table name as an argument. This would enable dynamically selecting the table at runtime without relying on the [Table] attribute.
For example:
var products = await client.From<ProductModel>("my_table_name").Get();
This approach would provide greater flexibility for developers working with multiple tables using the same model structure.
Describe alternatives you've considered
-
Manually overriding the [Table] attribute: This is cumbersome and requires code changes every time the table name needs to be updated, defeating the purpose of runtime flexibility.
-
Creating multiple models for each table: This leads to code duplication and maintenance issues, especially when the table structures are identical.
Additional context
Here is the current ProductModel class for reference:
[Table("coffeeteatable")]
public class ProductModel : BaseModel
{
[PrimaryKey("id")]
public int Id { get; set; }
[Column("name")]
public string Name { get; set; }
[Column("image")]
public string Image { get; set; }
[Column("size")]
public string Size { get; set; }
[Column("categoty")]
public string Categoty { get; set; }
[Column("subcategory")]
public string SubCategory { get; set; }
[Column("subsubcategory")]
public string SubSubCategory { get; set; }
[Column("barcode")]
public string Barcode { get; set; }
[Column("about")]
public string About { get; set; }
[Column("shops")]
public string Shops { get; set; }
[Column("ratingtable")]
public string RatingTable { get; set; }
[Column("county")]
public string Country { get; set; }
[Column("trademark")]
public string TradeMark { get; set; }
[Column("price")]
public string Price { get; set; }
}
The feature would simplify usage and improve developer experience, especially for scenarios where the table name varies dynamically.
Let me know if you’d like to add or modify anything!
- Dominant language
- C#
- Stars
- 701
- Forks
- 106
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 45
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/supabase-csharp
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
supabase/supabase-csharp#440 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
supabase/supabase-csharp#437 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
supabase/supabase-csharp#427 ·
-
supabase/supabase-csharp#409 · 1 comment · 1 assignee ·
-
area: realtime bug parity
supabase/supabase-csharp#393 · 1 assignee ·
All issues in supabase/supabase-csharp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100