New Posts New Posts RSS Feed: What is the Equivalent of DynamicEntity in new DevForce
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

What is the Equivalent of DynamicEntity in new DevForce

 Post Reply Post Reply
Author
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Topic: What is the Equivalent of DynamicEntity in new DevForce
    Posted: 13-Jul-2010 at 8:28pm
Yes, you are correct, and what you are doing in the Entity Framework is also supported by DevForce. (It is a bug if you can accomplish something in the Entity Framework, but not in DevForce.)
 
When you map those functions/stored procs in the Entity Framework, DevForce will generate code that will allow you to call the methods in an n-tier environment.  They can return entities as well as complex types or scalars.
 
Back to Top
dpollot44 View Drop Down
Newbie
Newbie
Avatar

Joined: 13-Jan-2010
Location: Rochester NY
Posts: 24
Post Options Post Options   Quote dpollot44 Quote  Post ReplyReply Direct Link To This Post Posted: 12-Jul-2010 at 9:44am
What you cannot do is to use EF or DevForce to query against back-end database tables that are neither part of your EF model nor accessed by one of your server-side methods that returns POCOs.

We have a need to execute arbitrary SQL against our legacy database, and this includes calling functions, executing stored procedures, etc.  Entity Framework absolutely DOES allow you to do this so long as you define classes that match properties to columns 1:1 (By virtue of their
ExecuteStoreQuery<T> and ExecuteStoreCommand methods). This allows us to execute queries that return types (basically data sets) that are not part of the Edm model.

What I gleaned from the brief read through that I did on PassThruESQL queries is that they only support returning types that are defined in the Edm model (within the edmx).  Is this true?  Are you guys deriving from ObjectContext in anyway that might allow us to do what we're looking to do as simply as the mechanism provided by EF?
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 25-Jun-2010 at 2:19pm
Since the Entity Framework only supports schemas at design-time, you would have to do this through POCO iintegration or call InvokeServerMethod and manually grab the data through the ADO Provider.
Back to Top
*Calsy View Drop Down
Groupie
Groupie


Joined: 02-Feb-2009
Location: Australia
Posts: 69
Post Options Post Options   Quote *Calsy Quote  Post ReplyReply Direct Link To This Post Posted: 24-Jun-2010 at 6:37pm

Hi Greg, Thanks for the reply.

Is there anyway than to pull data from a table/view at runtime that the EF doesnt have any previous knowledge of? i.e. At runtime the customer wants to create report that pulls back a certain set of data. We create the view in the database. Can we than somehow retrieve data from that view without having to generate the objects in the edmx etc etc?
 
Thanks
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 24-Jun-2010 at 6:22pm
DevForce 2010 doesn't talk directly to back-end databases: it talks to EF, and EF really wants your code to be independent of the back-end database. So EF lets you talk to it in LINQ and in ESQL.

ESQL is mostly useful for special situations where you need to compose a query as a text string, so let's talk about what you can do with LINQ. You can query against any entity defined in the EF model (and mapped there to a back-end table), returning arbitrary subsets of the entity's properties. You can also do even more interesting things like the following:

var q = _em1.Employees.Select(e => new { e.LastName, e.OrderSummaries });


The above, when exercised, will return an IEnumerable<a'>, where a' is an anonymous type. This particular anonymous type has two properties: a string and a RelatedEntityList<OrderSummary>.

DevForce also lets you query against Plain Old C Objects (POCOs). You create a server-side class with a method that returns an IEnumerable<Foo>, where a Foo is your plain old C object. This is documented today in the Business Object Persistence - Advanced document, in a section named "POCO Support in DevForce"; in the next release of DevForce it will be a stand-alone document named "POCO Support in DevForce".

What you cannot do is to use EF or DevForce to query against back-end database tables that are neither part of your EF model nor accessed by one of your server-side methods that returns POCOs.
Back to Top
*Calsy View Drop Down
Groupie
Groupie


Joined: 02-Feb-2009
Location: Australia
Posts: 69
Post Options Post Options   Quote *Calsy Quote  Post ReplyReply Direct Link To This Post Posted: 23-Jun-2010 at 10:01pm
Hi All, In DevForce classic we were able to create a passthrurdbqry, pump an sql string into the passthrurdbqry and have it return as an entitylist(Of DynamicEntity). Just wondering how we do the equivalent in the new version of DevForce?
 
I know there is the PassthruEsqlQuery but you dont feed it a raw sql string (requires entity sql) and it has to be returned as a type (if im wrong im sorry, blonde moment). Im hoping (which we did in classic) that I can just go "Select * From BlahTable" and return all the records accordingly. 
 
It doesnt have to be silverlight specific because it will be executed at the server.
 
Thanks
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down