0
1

Work with db AdventureWork2012, how could I work with table SalesOrderHeader which have scheme Sales: [Sales].[SalesOrderHeader]

[TableMapping("Sales.SalesOrderHeader")] 
[HierarchyRoot]
    public class SalesOrderHeader : Entity
    {
        [Key]
        [Field]
        public int SalesOrderID { get; private set; }

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

        public SalesOrderHeader(Session session, int salesorderid) :
            base(session, salesorderid)
        { }

    }

asked May 04 at 07:53

IlyaIlyaIlyaIlya's gravatar image

IlyaIlyaIlyaIlya
512

edited May 04 at 07:54


One Answer:

Hello IlyaIlyaIlyaIlya

You can't actually work with AdventureWorks2012 database because of some custom types like Name, Phone, OrderNumber and others. They can't be recognized by DataObjects.Net.

AdventureWorks2012 database uses database first approach - design database structure and then try to create some classes to work with tables somehow. DataObjects.Net uses another way of developing databases - code first. Thanks to it there is no need to think in database-related terms like tables, columns and so on. It allows to think in OOP way - just describe what types and relations between them you would like to have and DataObjects.Net will create all needed tables, columns, indexes and so on according to your classes.

If you have some other questions please welcome, I will answer them too.

answered May 10 at 14:43

Alexey%20Kulakov's gravatar image

Alexey Kulakov
52715

То есть вы хотите сказать что ваш ORM нельзя интегрировать в уже готовые решения? Почему я не могу подключиться к существующей схеме с типовыми решениями?

(May 24 at 07:08) IlyaIlyaIlyaIlya IlyaIlyaIlyaIlya's gravatar image

I'm saying that DataObjects.Net can't recognize user types used in AdventureWorks, at least for now. User types can be really different and complicated in different cases. We just can't predict all the types user can define. If a database uses standard types of MS SQL Server it is highly probable that DataObjects.Net will work with such database.

(May 24 at 10:48) Alexey Kulakov Alexey%20Kulakov's gravatar image
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