Developer forum

Forum » Development » Item types code first not being recognized

Item types code first not being recognized

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I am using the following code first item type definition:

  public class Person : ItemEntry
  {
    public Person()
    {
      DateOfBirth = new DateTime(1753, 1, 1);
    }

    [Group("General")]
    [Field("First name")]
    public string FirstName { get; set; }

    [Group("General")]
    [Field("Last name")]
    public string LastName { get; set; }

    public DateTime DateOfBirth { get; set; }

    [Group("Additional data")]
    [Field("Biography of the person")]
    [RichText]
    public string Bio { get; set; }
  }

When I compile this and run my site, the item type doesn't show up in the Management Center. I do get the following XML file in the Items folder:

<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<items>
  <item category="" name="Person" systemName="Person" description="" icon="" 
             largeIcon="" includeInUrlIndex="False" fieldForTitle="" title="" />
</items>

 

Note how it recognized the type, but none of the properties.

Am I missing something? Did something recently change that maybe requires me to add additional attributes to the properties? I am using the latest DW version: 8.4.1.12.

Thanks,

Imar

 

 

 


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Bump. Can anyone reproduce this?

 

Imar

 
Martin Nielsen
Reply

Hi Imar,

I'm pretty sure you need to annote your class with:

[Name("Person")]

It's not in the docs, but it's needed anyway :-)

 

BR
Martin

 

You must be logged in to post in the forum