I wanted to try DO4 (4.2.0). My DB is SQL Server 2008. UpgradeMode="Recreate" I had 2 classes based on Entity and 5 DB tables

And ALL my tables were deleted! I saw only 3 service tables Metadata.Assembly, Metadata.Extension, Metadata.Type

Cool and unique feature.

fortunately, it was test DB.


Updated at 15.05.2010 19:15:09

As you know programmers a very lazy by nature.

I didnt expect these dangerous modifications from simple ORM.

I had 2 classes mapped on tables, but these tables were deleted too. :D


Updated at 15.05.2010 19:21:06

Now I set upgradeMode="Recreate" I have 2 classes

namespace BookShopData.DomainModel
{
    [HierarchyRoot]
    [TableMapping("Users")]
    public class User : Entity
    {

        [Field, Key]
        public int UserID { get; set; }

        [Field]
        public string Login { get; set; }

        [Field]
        public string Surname { get; set; }
     }

  [HierarchyRoot]
    [TableMapping("Books")]
    public class Book : Entity
    {
        [Field, Key]
        public int BookID { get; set; }

        [Field]
        public string Title { get; set; }

        [Field]
        public int Cost { get; set; }
   }
}

Whe I try to run my application I receive 'Type 'BookShopData.DomainModel.Book' is not found in model.'

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

asked May 15 '10 at 18:56

Editor's gravatar image

Editor
46147156157


One Answer:

But UpgradeMode="Recreate" implies exactly this: all the tables must be deleted and new ones are created. You must use e.g. PerformSafely upgrade mode to ensure no data is lost on schema upgrade.

Or, do I understand you correctly: the issue is that such behavior is unexpected, when you're trying DataObjects.Net for the first time?


Can you send me either a sample (alex @ our web site dot com), or publish full stack trace here?

The issue is related to Domain.Build or configuration (App.config or programmatic), but there is no code related to this.

Concerning "Recreate" - partially, you're right... It's like "Format C:" hidden somwehere in App.config :( Moreover, we use this more intentionally everywhere in samples, since it allows to run them on the same database w/o caring about the schema. But I'm not sure what we can do here - so any ideas are welcome.

Btw:

answered May 15 '10 at 19:10

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

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