This question is locked. New answers and comments are not allowed.
I'm getting this error "No metadata has been registered for class 'OpenAccessTest.Domain.Category, OpenAccessTest.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. (This usually indicates, that either this class is not declared persistent or it is declared persistent but not enhanced. The class was loaded from file:///c:/users/carl/documents/visual studio 2012/Projects/OpenAccessTest/OpenAccessTest/bin/Debug/OpenAccessTest.Domain.DLL.)"
This is when I added an external "Category" class to my Fluent Model. The Category class is from a different class project in the same solution. I already made sure that the OpenAccess Enhancer was included in the project yet I always get the same error. So my question is, is it possible to add external class to fluent models?
OpenAccessContext code:
Mapping code:
Category class code:
Thank you in advance.
This is when I added an external "Category" class to my Fluent Model. The Category class is from a different class project in the same solution. I already made sure that the OpenAccess Enhancer was included in the project yet I always get the same error. So my question is, is it possible to add external class to fluent models?
OpenAccessContext code:
namespace OpenAccessTest { using System.Linq; using OpenAccessTest.Domain; using Telerik.OpenAccess; using Telerik.OpenAccess.Metadata; public partial class FluentModel : OpenAccessContext { private static string connectionStringName = @"Server=localhost;Port=3306;Database=testdb;Uid=root;Pwd=batsoy;"; private static BackendConfiguration backend = GetBackendConfiguration(); private static MetadataSource metadataSource = new FluentModelMetadataSource(); public FluentModel() : base(connectionStringName, backend, metadataSource) { } public static BackendConfiguration GetBackendConfiguration() { var backend = new BackendConfiguration { Backend = "MySql", ProviderName = "MySql.Data.MySqlClient" }; return backend; } public IQueryable<Category> Categories { get { return this.GetAll<Category>(); } } }}Mapping code:
namespace OpenAccessTest{ using System.Collections.Generic; using OpenAccessTest.Domain; using Telerik.OpenAccess.Metadata; using Telerik.OpenAccess.Metadata.Fluent; public partial class FluentModelMetadataSource : FluentMetadataSource { protected override IList<MappingConfiguration> PrepareMapping() { var mappingConfigurations = new List<MappingConfiguration>(); var categoryConfig = new MappingConfiguration<Category>(); categoryConfig.MapType().UseDefaultMap().ToTable("Category"); mappingConfigurations.Add(categoryConfig); return mappingConfigurations; } protected override void SetContainerSettings(MetadataContainer container) { container.NameGenerator.RemoveCamelCase = false; container.NameGenerator.SourceStrategy = NamingSourceStrategy.Property; } }}Category class code:
namespace OpenAccessTest.Domain{ public class Category { public int Id { get; set; } public string Name { get; set; } }}