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

mapping value references

6 Answers 58 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Fred
Top achievements
Rank 1
Fred asked on 25 Aug 2010, 08:08 PM
  Hi,
  I'm starting to evaluate open access and reading the docs i saw this: http://www.telerik.com/help/openaccess-orm/fields-mapping-value-references.html . It's a feature i really want but i have some doubts...

 1- say i want to map CustomerName in order class it will work too right ?
 2 - Can i do this using the visual designer? I Couldn't find this xml mapping in my test project.

thanks in advance,
Fred.

6 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 26 Aug 2010, 09:29 AM
Hi Fred,

You won't find the xml (as in the docs) when you are using the Visual Designer, since the Visual Designer uses a new xml format. The xml in the docs is the old xml format.
So basically what are you trying to achieve? To have the Name property of Order.Customer available as a property (say CustomerName) on the Order class?

Regards

Henrik
0
Fred
Top achievements
Rank 1
answered on 26 Aug 2010, 03:19 PM
 Hi Henrik,
 Thanks for the response. Yes, this is what i'm trying to achieve.

 Fred.
0
IT-Als
Top achievements
Rank 1
answered on 26 Aug 2010, 03:51 PM
Hi Fred,

Thanks for elaborating.

If you need a "display only" property for your UI control (a Grid for example) you can extend the Order class, like (in pseudo code):

public class Order
{
   // Private
   private Customer customer;
..
..
..
   public string CustomerName
   {
      get { if (customer != null) return customer.Name else return null; }
   }
}

You might do this extension in a separate partial class..

Regards

Henrik
0
Fred
Top achievements
Rank 1
answered on 26 Aug 2010, 06:21 PM
This will work, thanks!

But, just to make sure, it's not possible to map this in designer or in xml ?

Fred.

edit:

  After some more digging in the documentation  i'm somewhat confused with the IobjectScope and OpenAcessContext objects. In the help files they show a "OpenAccess ORM Visual Designer" that show the Context object and a "OpenAccess ORM Classic" using the IObjectScope in the samples.

  Can someone explain the diference and when to use one or another?

Fred.
0
Accepted
IT-Als
Top achievements
Rank 1
answered on 27 Aug 2010, 07:35 AM
Hi Fred,

I don't know if you can map it in the Visual Designer. The only reason I can think of why to map it is that you want content (here CustomerName) back in the database.

Anyway.. the difference between the "Classic" and "Visual Designer" is merely the API and the tools used in Visual Studio.

The "Classic" API uses the IObjectScope to gain access to persistent objects and other stuff you can do with them. But the "Visual Desginer" API uses the OpenAccessContext to gain access.
Likewise, with the "Classic" you use the old wizards for modelling/mapping (they are in fact hidden from the OpenAccess menu in Visual Studio, but you can still have them shown in there if you want to). And the "Visual Designer" eh.. yeah... uses the Visual Designer for modelling/mapping.

So the difference is (roughly said) on the surface (UI and API) that the developer uses to model, map and program against OpenAccess.

Still if you are beginning a new project (or porting and existing non-OpenAccess project) targeting OpenAccess as ORM I would definitely advice you to use the "Visual Designer" way of doing stuff.
Since, all new development efforts (as far as I have heard) will go into the new OpenAccessContext and Visual Designer. And "Classic" is in kind of "maintenance" mode

Hope this clears things up.

Regards

Henrik
0
Fred
Top achievements
Rank 1
answered on 27 Aug 2010, 01:15 PM
Thank you again!

Fred.
Tags
Getting Started
Asked by
Fred
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
Fred
Top achievements
Rank 1
Share this question
or