Search code examples
.netentity-framework-coremariadb.net-core-2.0pomelo-entityframeworkcore-mysql

The collection argument 'properties' must contain at least one element. when using dotnet ef


I have two very simple tables

CREATE TABLE `site` (
  `id` int(2) NOT NULL AUTO_INCREMENT,
  `Name` text COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

And

CREATE TABLE `program` (
  `Contract` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `Name` text COLLATE utf8_unicode_ci NOT NULL,
  `SiteId` int(2) NOT NULL,
  PRIMARY KEY (`Contract`),
  KEY `SiteId` (`SiteId`),
  CONSTRAINT `SiteId` FOREIGN KEY (`SiteId`) REFERENCES `site` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

There is a FK on the SiteId field of the program table.

When I try and generate my models using

dotnet ef dbcontext scaffold "constring" "Pomelo.EntityFrameworkCore.MySql" -f -o "Models"  -d

It returns the error

The collection argument 'properties' must contain at least one element.

Removing the FK the model generates fine. What is wrong with my model?


Solution

  • This error was resolved with version 2.0.0-rtm-10057.