-
-
Notifications
You must be signed in to change notification settings - Fork 20
Custom Table Name, Priority TableAttribute.Name > CustomName > MappedType.Name #57
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
Change Tab:4 to Space:4
Hey @ChaosVan, thanks for the PR. What's your use case for this again? Isn't |
I have reformatted the code by Tab (instead of 4 space) On my case, there are some requirements: some tables have the same structure but different names, and when calling CreateTable function, I need to pass the same Type but different Names. |
There are still lots of code formatting changes, but it's ok, I'm able to see the relevant changes directly from the relevant commits.
Got it, that's a legit use case. If you're worried you'll have to repeat yourself over and over again for tables with similar content, maybe you could use a common base class and derive it to the desired models, each one with the correct table name, wouldn't this work? Then for the insert/update/delete/query calls you won't need to specify the base type and custom table name, just pass the child class directly and it will reference the correct table automatically. |
Thank you very much. I understand the ORM approach, but in practice, I might not know the table names in advance—they could be dynamically determined at runtime when I need to create such a table. |
Ok, now that's an unusual requirement. But it's legit, I agree it can be useful. For the sake of API stability, I'll ask you to create new method overloads accepting the I also don't like much the fact that you reformatted all code in the file, I prefer if this PR only had the relevant changes in API / implementation. We can/should reformat the code, but elsewhere, likely in a separate PR. Even after reindenting the file with tabs, there are still lots of lines changed that are not relevant for the new functionality. |
I tried to revert the code to its pre-Format state, but it was quite cumbersome... If this use case isn't common, perhaps I can wait until you apply the Format to the main branch, then merge it into my branch and finally attempt to submit a PR. |
Hello, GilZoide~
I have implemented the custom TableName functionality locally and am now sharing it with you. Please review to see if a merge is needed. Additionally, I made some adjustments to the formatting in SQLite.cs; feel free to reformat it according to your preferences.