How to convert existing classes to OA entity?

2 posts, 0 answers
  1. Truman
    Truman avatar
    1 posts
    Member since:
    Nov 2010

    Posted 26 Feb 2011 Link to this post

    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;
            }
    }
  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 02 Mar 2011 Link to this post

    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!
  3. DevCraft banner
Back to Top