New Posts New Posts RSS Feed: DevForce EF and asp.net (No Silverlight!)
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

DevForce EF and asp.net (No Silverlight!)

 Post Reply Post Reply
Author
Dutchboy View Drop Down
Newbie
Newbie
Avatar

Joined: 01-Jun-2011
Location: Spain
Posts: 3
Post Options Post Options   Quote Dutchboy Quote  Post ReplyReply Direct Link To This Post Topic: DevForce EF and asp.net (No Silverlight!)
    Posted: 02-Jun-2011 at 12:16am
Hi,

I'm setting up an asp.net system - Webforms MVP, Memcached, XMPP and other nice gadgets...

Thing is.... I'm used to Entity Framework (EF)... I've even tried horribly to get Telerik Open Access (OA) working - and ORM that does not do what it should....

Both EF and OA follow a pattern that makes sense with the "web" - State Less - every time a user clicks or "moves" or interacts, it is in fact a complete new action. A new action, as in the system disconnects completely...

"Disconnecting completely" is the very nature of the "web". After each (page/http)request, a user might go to another site...

So, the pattern I learned is to put all datacode with "using" statements...

        public Account GetAccountByID(int AccountID)
        {
            Account account = null;

            using (DataContext dc = conn.GetContext())
            {
                account = (from a in dc.Accounts
                           where a.AccountID == AccountID
                           select a).FirstOrDefault();
            }
            return account;
        }



The above using statement takes care of disposing the ObjectContext (EF). Per request.

My question is - how does DevForce handle disposing?

From the info I've read, the (DevForce) EntityManager is the equivalent for the (EF) ObjectContext - am I correct?

I've tried a using statement with EntityManager, but the Dispose() is not implemented (not derived from IDisposable) so that doesn't work.... Any suggestions?

I've searched thoroughly through the documentation, but I could not find any sampling for asp.net - only Silverlight/WPF - does that mean DevForce doesn't like asp.net?

How do you connect with memcached?

Thanks for answering all my questions!

Regards!
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: 03-Jun-2011 at 12:22pm
Hi Dutchboy;

Our EntityManager does not implement IDisposable but when the EM goes out of scope, it will be disposed and nothing is holding a reference once the query has executed and the page request completes.

We're still working on a usable sample for ASP.NET but DevForce does work with it. Here's another post that had the same discussion. http://www.ideablade.com/forum/forum_posts.asp?TID=2645&KW=ASP%2ENET&PID=10589&title=aspnet#10589

Regarding Memcached, Unfortunately, I don't have an answer to your question since DevForce doesn't directly interact with it.
Back to Top
Dutchboy View Drop Down
Newbie
Newbie
Avatar

Joined: 01-Jun-2011
Location: Spain
Posts: 3
Post Options Post Options   Quote Dutchboy Quote  Post ReplyReply Direct Link To This Post Posted: 14-Aug-2011 at 1:07am
Hi DenisK,

You've replied 30th of June - some time ago - can you tell me if / where there is a sample of the Devforce approach how to interact with asp.net?

Thanks, Lars
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: 15-Aug-2011 at 3:28pm
Hi Lars,

With all the recent interest in HTML 5,we are focusing much of our efforts there, so I don't know when we might go back and create a WebForms sample. Sorry, I know that's not much help.

In case you're interested in an HTML/JavaScript client we just published these:

Back to Top
Dutchboy View Drop Down
Newbie
Newbie
Avatar

Joined: 01-Jun-2011
Location: Spain
Posts: 3
Post Options Post Options   Quote Dutchboy Quote  Post ReplyReply Direct Link To This Post Posted: 15-Aug-2011 at 3:46pm
Hi Dennis,

Thanks for answering - even though I might not like the message :-)

It tells me you're serious... Can you tell me if it is possible with webforms (MVP) - not the "how", but the "if".

The thing that I am looking for is flexibility... multiple data sources (DB servers)... a caching layer... etc...

About EF (4.1) - and yes, it comes from MS and thus it is being hyped - it does have "everyone" blogging about it, which helps a lot (or not, but being informed one notices instantly the info is bogus or not)

Devforce has been around for some time - I know - but is it worth the investment (in time and in money) - I know it is hard to tell...

In short, I'm in the process of choosing which technology to use for a new system...

Thanks for reading,

Lars
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: 16-Aug-2011 at 5:08pm
Lars,

Yes, DevForce works just fine with both WebForms (MVP style) as well as ASP.NET MVC. The key decision you have to make is whether to put the EntityManager in session or create a new one for each request. If you are keeping track of user state across pages, then putting it in session can save you a bit of bookkeeping work, because the EntityManager cache holds the state of all the potentially modified business objects for the workflow.

We have a beta of Code First (EF 4.1) right now, with full support coming in the next release (6.1.3). You can learn more here and watch some videos:

You also mentioned multiple database servers, which is not a problem for DevForce. You can either use one EntityManager per model, or you can use a single EntityManager with multiple models which also allows them to participate in the same transaction.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down