|
Post by gamer2300 on Dec 5, 2020 11:28:46 GMT
There is some tecnique or script to retrieve the correct c# class definition having a db? So if i create a db and a table with DbBrowser how i can obtain the class definition? i always must write them manually?
|
|
|
Post by echo17 on Dec 5, 2020 14:45:40 GMT
The ORM class definition is just there for your convenience. It lets you define your fields (along with properties that can be adjusted by those fields) and have them mapped automatically for you. This is great because you get typed members without having to manually convert your object values from the query. It does require you to set up a c# class structure if you wish to use ORM.
If you do not want to use the ORM, you can just use the QueryGeneric method of SimpleSQLManager to return a SimpleDataTable structure. This structure is a list of object fields that you will need to cast manually if you desire.
I personally prefer to set up my c# ORM class once, let it map everything for me when I query, and not have to worry about casting the fields later.
|
|
|
Post by gamer2300 on Dec 5, 2020 20:40:36 GMT
i make this question because see that with dbbrowser i can define a field like text but can't define the max length so when see ORM definition i think that it is more convenient.
|
|
|
Post by echo17 on Dec 6, 2020 14:36:02 GMT
Sorry, I’m not understanding what your question is then. If you were asking if you could make a C# class and then create a table in code, then yes you can do that. Check out the API documentation for how to create tables based on class definitions.
|
|
|
Post by echo17 on Dec 6, 2020 15:16:55 GMT
Specifically, to create a table using a class definition, you would call the CreateTable method. See Demo #5 for examples of this.
|
|