Mapping for class BLGBlogPost' is specified in file 'config' but the class could not be found

11 posts, 0 answers
  1. Alec
    Alec avatar
    43 posts
    Member since:
    Mar 2009

    Posted 20 Sep 2009 Link to this post

    Why do I get this error:

    [MetadataException: Mapping for class 'atg001.BO.BLGBlogPost' is specified in file 'config' but the class could not be found.

    I have searched through all files in the solution and I cannot find a reference of "atg001.BO". The file's name space is actually called btl001.BO.Blog.BLGBlogPost. WHere can I find this in which config and how do I change it.
  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 28 Sep 2009 Link to this post

    Hello Alec,

     Did you find my reply to the same problem ,posted in another thread in the forum, helpful?
    Do let us know how we can help you further.

    Kind regards,
    Ady
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Tom
    Tom avatar
    11 posts
    Member since:
    Jan 2012

    Posted 02 Jan 2013 Link to this post

    I'm hitting a very similar issue to this since changing the namespace of the project holding the orm project. however the link you've posted above doesnt work, could you relink the post or explain the steps to locate this config file and where it needs updating.
    Thanks
    Tom..
  5. Ady
    Admin
    Ady avatar
    589 posts

    Posted 02 Jan 2013 Link to this post

    Hello Tom,

     Are you using the 'Classic' product (mapping is in the app.config file) or are you using the domain model approach (.rlinq file)?
    If you are using the classic approach you can use the 'Check Settings' dialog (Telerik->OpenAccess->Configuration->Check Settings menu entry) and run the checks and fix the resulting error. This error occurs because the <namespace name="xyz"...> node does not have the appropriate value. You verify this in the app.config file.

    Greetings,
    Ady
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  6. Tom
    Tom avatar
    11 posts
    Member since:
    Jan 2012

    Posted 02 Jan 2013 Link to this post

    this is using .rlinq with your latest release.
  7. Ady
    Admin
    Ady avatar
    589 posts

    Posted 03 Jan 2013 Link to this post

    Hello Tom,

     Can you send me the .rlinq file so that I can try and reproduce the error and fix the file if required?

    Kind regards,
    Ady
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  8. Tom
    Tom avatar
    11 posts
    Member since:
    Jan 2012

    Posted 03 Jan 2013 Link to this post

    Thanks,
    I had already tried manually updating the file as .rlinq file still contained the old namespace however changing all references to the namespace to the new one did not resolve the issue so ive deleted and moved to the fluent api. I would still be interested in the steps you would have taken to resolve, if you still need the file I believe its relatively easy to reproduce so if needed I can create a file and send it to you.
    Thanks
    Tom.
  9. Ady
    Admin
    Ady avatar
    589 posts

    Posted 03 Jan 2013 Link to this post

    Hello Tom,

     It would be nice if you can send the .rlinq file so that I can see what the problem is. I would still expect that references to the old namespace still exist in the file, maybe they are just no visible in the designer.

    Regards,
    Ady
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  10. Gary
    Gary avatar
    28 posts
    Member since:
    Jun 2015

    Posted 25 Aug 2015 Link to this post

    I am experiencing the same exception while using the FluentAPI. I have a class defined that derives from a base class which defines some common properties.

    interface IModificationTracker
    {
        DateTime CreatedDate { get; set; }
        String CreatedBy { get; set; }
        DateTime UpdatedDate { get; set; }
        String UpdatedBy { get; set; }
    }
     
    public abstract class ModelBase : IModificationTracker
    {       
        public DateTime CreatedDate { get; set; }
        public String CreatedBy { get; set; }
        public DateTime UpdatedDate { get; set; }
        public String UpdatedBy { get; set; }
    }
     
     
    public class DeliverableType : ModelBase
    {       
        public Int64 ID { get; set; }
        public String Label { get; set; }
        public String Description { get; set; }
    }

     

    I then map it to the underlying table ...

    protected override IList<MappingConfiguration> PrepareMapping()
    {
        List<MappingConfiguration> configurations = new List<MappingConfiguration>();
     
        #region DeliverableType
     
        MappingConfiguration<DeliverableType> typeMap = new MappingConfiguration<DeliverableType>();
        typeMap.MapType(model => new
        {
            deliverable_type_id          = model.ID,
            deliverable_type_label       = model.Label,
            deliverable_type_description = model.Description,
            created_date                 = model.CreatedDate,
            created_by                   = model.CreatedBy,
            updated_date                 = model.UpdatedDate,
            updated_by                   = model.UpdatedBy
     
        }).ToTable("deliverable_types");
        //
        // Identify contraints on fields
        typeMap.HasProperty(c => c.Label).WithVariableLength(100);      // nvarchar(100)
        typeMap.HasProperty(c => c.Description).WithInfiniteLength();   // nvarchar(MAX)
        //
        // Identify the Primary Key
        typeMap.HasProperty(c => c.ID).IsIdentity(KeyGenerator.Autoinc);
        //
        // Define when to update the CreatedDate and UpdatedDate timestamps
        typeMap.HasProperty(c => c.CreatedDate).IsCalculatedOn(DateTimeAutosetMode.Insert);
        typeMap.HasProperty(c => c.UpdatedDate).IsCalculatedOn(DateTimeAutosetMode.InsertAndUpdate);
     
        #endregion DeliverableType
         
     
        configurations.Add(typeMap);
        return configurations;
    }
     

    And make it available through the context ...

    public partial class DbContext : OpenAccessContext
       {
     
           public IQueryable<DeliverableType> DeliverableTypes
           {
               get
               {
                   return this.GetAll<DeliverableType>();
               }
           }
            
           // ... Connection configuration goes here
     
       }

     

    Then when I attempt to add a new entity to the table ...

     

    using (var ctx = new DbContext())
    {
        DeliverableType newType = new DeliverableType
        {
            CreatedBy = "UNIT TEST",
            UpdatedBy = "UNIT TEST",
            Description = "TEST DESCRIPTION",
            Label = "TEST LABEL",
            CreatedDate = DateTime.Now,
            UpdatedDate = DateTime.Now
        };
     
        ctx.Add(newType);
        ctx.SaveChanges();
    }

     

      I get the error ...

    Telerik.OpenAccess.Exceptions.MetadataException: Mapping for field '<CreatedDate>k__BackingField' is specified in the file 'config', but the field is not present in the class 'InnovativeFoto.BLL.Models.DeliverableType'. --> FromMetadataContainer/namespace[InnovativeFoto.BLL.Models]/class[DeliverableType]/field[<CreatedDate>k__BackingField]

     

    Any thoughts on what could be causing this? I did everything according to the instructions. 

     

    Here is the table schema if that helps ... 

    CREATE TABLE [dbo].[deliverable_types](
        [deliverable_type_id] [bigint] IDENTITY(1,1) NOT NULL,
        [deliverable_type_label] [nvarchar](100) NOT NULL,
        [deliverable_type_description] [nvarchar](max) NULL,
        [created_date] [datetime] NOT NULL,
        [created_by] [nvarchar](100) NOT NULL,
        [updated_date] [datetime] NOT NULL,
        [updated_by] [nvarchar](100) NOT NULL,
     CONSTRAINT [PK_deliverable_types] PRIMARY KEY CLUSTERED
    (
        [deliverable_type_id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

  11. Ady
    Admin
    Ady avatar
    589 posts

    Posted 28 Aug 2015 Link to this post

    Hello Gary,

     You have forgotten to map the base class and the inheritance between the 2 types and hence you get that error. Telerik DataAccess is trying to find the field in the type and its defined in the base type.

    Please have a look this documentation for mapping inheritance hierarchies.

    Do get back in case you need further assistance.

    Regards,
    Ady
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  12. Gary
    Gary avatar
    28 posts
    Member since:
    Jun 2015

    Posted 28 Aug 2015 in reply to Ady Link to this post

    DOH!! That was it! thank you!
Back to Top
DevCraft banner