0
J'utilise subsonique SimpleRepository:SubSonic3 - Colonne « CategoryId » ne peut pas être nulle
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SubSonic.DataProviders;
using SubSonic.Repository;
namespace SubSonicTest
{
class Program
{
public class Product
{
public int ProductID { get; set; }
public int CategoryID { get; set; }
public string ProductName { get; set; }
public decimal UnitPrice { get; set; }
public bool Discontinued { get; set; }
}
static void Main(string[] args)
{
var repo = new SimpleRepository("SubSonic", SimpleRepositoryOptions.RunMigrations);
var newProduct = new Product();
newProduct.CategoryID = 5;
newProduct.ProductName = "Pretzel";
newProduct.UnitPrice = 100;
newProduct.Discontinued = false;
repo.Add<Product>(newProduct);
}
}
}
Cependant, quand je cours, j'obtiens: Colonne « CategoryId » ne peut pas être nulle est avec MySQL et Windows et VS2008. Des idées?
Merci
Bien qu'étrangement son code semble spécifier une valeur de CategoryID. –
Je pensais que le constructeur essayait peut-être de mettre la propriété à zéro? Je sais que ça a l'air dingue, mais je me suis dit que si ça avait fonctionné, alors hoorah! – CmdrTallen