This is a migrated thread and some comments may be shown as answers.

How to convert existing classes to OA entity?

1 Answer 53 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Truman
Top achievements
Rank 1
Truman asked on 26 Feb 2011, 03:21 PM
I have an existing solution with hard-coded test data. I am now ready to persist that classes to the database and wanted to use OpenAccess for this. How can I simply make the below class persistable? Can I just inherit something from OA or why can't I just dragg the class to the "Entity Diagram" for auto-creation? Thanks for any help.

    [DataContract(Namespace = "")]
    public class Element
    {
        [DataMember(Name = "id", EmitDefaultValue = false)]
        public Guid Id
        {
            get;
            set;
        }
 
        [DataMember(Name = "name", EmitDefaultValue = false)]
        public string Name
        {
            get;
            set;
        }
 
        [DataMember(Name = "date", EmitDefaultValue = false)]
        public DateTime SomeDate
        {
            get;
            set;
        }
}

1 Answer, 1 is accepted

Sort by
0
Petko_I
Telerik team
answered on 02 Mar 2011, 10:58 PM
Hello Truman,

In order to achieve your goal you may use the Fluent Mapping API. Through this API you can map your existing classes to the relational objects such as tables in the database. Here is a dedicated help section that elaborates on the steps needed to perform the mapping. With the visual designer approach you can either reverse map a database schema or create your entities in the diagram but the classes associated with the diagram are always automatically generated. That is why you cannot drag a user defined class to the diagram.  

We do hope you will find the help section useful. Do not hesitate to contact us should any questions arise.

All the best,
Petko_I
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Development (API, general questions)
Asked by
Truman
Top achievements
Rank 1
Answers by
Petko_I
Telerik team
Share this question
or