-
Notifications
You must be signed in to change notification settings - Fork 146
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
Missing Create(...)
function
#773
Comments
Shouldn't be anything special. Your table has to have non-nullable fields. What IDE you are using? VS Code, or VS for Mac or something else? |
It's VS Code. Here's the table definition for reference. CREATE TABLE `foo` (
`id` int NOT NULL AUTO_INCREMENT
`name` varchar(50) NOT NULL,
`description` varchar(50) NOT NULL,
`type` enum('A', 'B') NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
); Another table definition that also doesn't have the function generated is defined as CREATE TABLE `bar` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`description` varchar(45) NOT NULL,
`type` varchar(2) NOT NULL,
`sector_id` int NOT NULL,
`external_id` int DEFAULT NULL,
PRIMARY KEY(`id`),
KEY `sector_id` (`sector_id`),
CONSTRAINT `bar_sectors_fk` FOREIGN KEY (`sector_id`) REFERENCES `sectors` (`id`)
); |
I'm just think because maybe there is some exception in design time with intellisense. I've sometimes debugged VS by attaching another instance of VS to another VS, but I have no idea if you can debug VS Code. |
After reading the docs I wanted to use the
Create(...)
style function as recommended, to ensure that if the columns in the DB change my code will fail to compile due to a mismatch between the required columns in the DB and the values passed to the function. However, I am only able to find the parameterlessCreate()
function in intellisense for all of the tables in the DB. I've also tried crafting the function name manually based on examples and compiling the code, but that fails to compile, so it appears that the type provider has not provided these functions.Am I missing a setting in the type provider somewhere? I've checked the documentation but couldn't find anything.
Expected behavior
I expected to find that the
Create(...)
function had been generated.Desktop:
Additional context
The text was updated successfully, but these errors were encountered: