New Posts New Posts RSS Feed: Mapping Dynamic SQL with IdeaBlade
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Mapping Dynamic SQL with IdeaBlade

 Post Reply Post Reply
Author
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Topic: Mapping Dynamic SQL with IdeaBlade
    Posted: 16-May-2012 at 1:19pm
Hi stevef,

You're correct that DF doesn't provide those 2 Execute* methods. As I mention above, you can create an ObjectContext by passing in the EdmKey.ConnectionString to the constructor. We recommend that you do this on the server via InvokeServerMethod.

You've probably already known this but EntityFramework (thus DevForce as well) doesn't currently support importing StoredProcs with TVP. (http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/29bcd888-6d79-4f60-8858-3a11a650018b)
Back to Top
stevef View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Jul-2011
Location: NY
Posts: 9
Post Options Post Options   Quote stevef Quote  Post ReplyReply Direct Link To This Post Posted: 15-May-2012 at 2:04pm
Actually, I see a need to access ObjectContext as well, since it seems (or I simply can't find how to do it in DF) that DF is missing the ExecuteStoredCommand() and ExecuteStoreQuery() functions.  These would be required if you would like to do something like calling a stored proc that takes tabled-value parameter. 
 
Any ideas on how to make that happen?
 
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 19-Jan-2012 at 2:49pm
Well, it's not "wrong". It's just not recommended. If you insist on calling the ObjectContext directly, use it sparingly since if you're using it too much, that'll defeat the purpose of having DevForce.

You can create your own ObjectContext by passing in the ClientEdmKey.ConnectionString to its constructor.

However, before you do so, I'm really curious as to the original problem. What exactly is the exception you're getting? Do you get the exception when you try to map the Dynamic SQL StoredProc to your edmx?
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 18-Jan-2012 at 11:22pm
Hello Denisk,
it's a dynamic query with a pivot grid... for now I reverted to ADO.net and a generic object I map... just a question, it's wrong to create in a Devforce Application Framework a wcf service and handle in an old way the stuffs? I found no way for calling ADO .NET directly from IdeaBlade
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 18-Jan-2012 at 11:35am
Hi Paolo,

I'm not sure I understand the exception and I'm not entirely convinced that DevForce is at play here. Have you tried mapping without using DevForce and see if that succeeds?
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 17-Jan-2012 at 1:05am
Hello IdeaBlade,
I've got a problem with mapping an object... in a Master-Detail gridview I need to give the possibility to export particular calculated data for the whold grid... I've got a stored procedure that performs this calculation

SELECT <somefields>
INTO #tmp
FROM source

DECLARE @COLUMNS VARCHAR(8000)

SELECT @COLUMNS = COALESCE(@COLUMNS + ',[' + CAST([CODICE CAMPO] AS VARCHAR) + ']', '[' + cast([CODICE CAMPO] as varchar)+ ']')
FROM #tmp
GROUP BY [CODICE CAMPO]
ORDER BY [CODICE CAMPO]

DECLARE @QUERY VARCHAR(8000)

SET @QUERY = 'SELECT * FROM #tmp PIVOT (MAX([VALORE CAMPO]) FOR [CODICE CAMPO] IN (' + @COLUMNS + ')) AS P'

EXECUTE(@QUERY)

I got an exception that 'xxx' cannot be mapped....
any suggestion?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down