I try to create a new object after opening transaction and I get this error: Table 'Byte-Generator' is not found in storage.

What I'm missing?

Here is a sample of the object that I try to create:

Imports Xtensive.Storage
Imports Xtensive.Core
Imports Xtensive

<Serializable(), HierarchyRoot(), Index("Description")> _
Public Class TypeProduction
   Inherits Xtensive.Storage.Entity

   Private _ID As Byte
   Private _description As String

   Public Sub New()
   End Sub

   <Key(), Field(), Xtensive.Storage.FieldMapping("ID")> _
   Public Property ID() As Byte
         Return _ID
      End Get
      Private Set(ByVal value As Byte)
         _ID = value
      End Set
   End Property

   <Field()> _
   Public Property Description() As String
         Return _description
      End Get
      Set(ByVal value As String)
         _description = value
      End Set
   End Property
End Class

The table in my database have an AutoNumber Identity column set to ID.

This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by Samuel.

asked Feb 25 '10 at 05:19

Editor's gravatar image


One Answer:

1. Set [KeyGenerator(KeyGeneratorKind.None)] @ ID property.

This will ensure DO won't try to generate keys of Byte type by its own. AFAIK, only integer types higher than short\ushort are supported by built-in key generator. I'll give mode details on this after looking up our tests.

Another option is to change key type to short / int / long, etc.

2. The getter and setter you use are wrong: they rely on field you declared, but they must call GetFieldValue \ SetFieldValue methods instead.

See this section: http://dataobjectsdotnet.googlecode.com ... TypeEntity


  • You should use either autoproperties - in this case our PostSharp aspects will properly rewrite their MSIL code during the compilation.

  • Or write your own ones, but relying on GetFieldValue \ SetFieldValue methods (as it's shown in decompiled version of autoproperty there).

answered Feb 25 '10 at 11:21

Alex%20Yakunin's gravatar image

Alex Yakunin

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA