FluentNHibernate mapping - No Persister for... Please help.
-
Hi all, I would greatly appreciate any assistance on this, I have no idea what is wrong :( I have a program that runs through excel sheets and populates the following classes: Product > (contains) > Recipe > (contains multiple) > Material The population of the objects work 100%, but I keep getting a "No Persister for Product" error when trying to .SaveOrUpdate(product); Please go through the code examples and database structure below and let me know what I'm doing wrong. I've been battling for ages and simply can't find the right path. To confirm, I have included the mapping files as an embeded resource (this solved my previous problem). Much appreciated and thank you in advance! =================== Database structure: =================== -Products Table- Contains various fields, one of which is 'RecipeID' which links to the -Recipes Table-. One product can have one recipe -Recipes Table- Contains ID, PercentageInKg, and MaterialID which links to the -RawMaterials Table-. The RecipeID is not unique, if a recipe has 5 materials it will have eg. ID=223 for all 5 entries (as the 5 entries form part of 1 recipe), MeterialID to each unique material entry, and PercentageInKg for each MaterialID which is the amount for this specific recipe -RawMaterials Table- Contains ID, Name, and CostPerKg. The MaterialID is unique, listing specific raw materials and its cost per kg. ================= Class Structures: =================
public class Product { public virtual int ProductID { get; set; } public virtual string Name { get; set; } public virtual decimal BatchSize { get; set; } public virtual decimal FormulaSG { get; set; } public virtual string Appearance { get; set; } public virtual string Smell { get; set; } public virtual decimal Yield { get; set; } public virtual string SolidsPercentage { get; set; } public virtual string pH { get; set; } public virtual string Viscosity { get; set; } public virtual string Colour { get; set; } public virtual string FoamDefinition { get; set; } public virtual DateTime CreatedDate { get; set; } public virtual Recipe Recipe { get; set; } #region Overrides public override bool Equals(object obj) {...} public override int GetHashCode() {...} #endregion } public class Recip
-
Hi all, I would greatly appreciate any assistance on this, I have no idea what is wrong :( I have a program that runs through excel sheets and populates the following classes: Product > (contains) > Recipe > (contains multiple) > Material The population of the objects work 100%, but I keep getting a "No Persister for Product" error when trying to .SaveOrUpdate(product); Please go through the code examples and database structure below and let me know what I'm doing wrong. I've been battling for ages and simply can't find the right path. To confirm, I have included the mapping files as an embeded resource (this solved my previous problem). Much appreciated and thank you in advance! =================== Database structure: =================== -Products Table- Contains various fields, one of which is 'RecipeID' which links to the -Recipes Table-. One product can have one recipe -Recipes Table- Contains ID, PercentageInKg, and MaterialID which links to the -RawMaterials Table-. The RecipeID is not unique, if a recipe has 5 materials it will have eg. ID=223 for all 5 entries (as the 5 entries form part of 1 recipe), MeterialID to each unique material entry, and PercentageInKg for each MaterialID which is the amount for this specific recipe -RawMaterials Table- Contains ID, Name, and CostPerKg. The MaterialID is unique, listing specific raw materials and its cost per kg. ================= Class Structures: =================
public class Product { public virtual int ProductID { get; set; } public virtual string Name { get; set; } public virtual decimal BatchSize { get; set; } public virtual decimal FormulaSG { get; set; } public virtual string Appearance { get; set; } public virtual string Smell { get; set; } public virtual decimal Yield { get; set; } public virtual string SolidsPercentage { get; set; } public virtual string pH { get; set; } public virtual string Viscosity { get; set; } public virtual string Colour { get; set; } public virtual string FoamDefinition { get; set; } public virtual DateTime CreatedDate { get; set; } public virtual Recipe Recipe { get; set; } #region Overrides public override bool Equals(object obj) {...} public override int GetHashCode() {...} #endregion } public class Recip