I'm using EF4.1 in code-first style to persist POCO objects for a small ASP.NET MVC 3-based webapp in an SQL Azure DB 'MyAppsDB'. The tables are automatically created in MyAppsDB when they don't exist. I'd like to host the app on SQL Azure, but I don't want to pay $10/mo for an extra 1GB DB to store 50MB of session state, and using Cache would be even more expensive.
I'd like to store session state in MyAppDB along with my app's models. Is there a way to do this? Can I have the Session table auto-created if it doesn't exist, same as EF code-first models?
I've tried modifying my web.config as follows:
<sessionState mode="Custom" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
connectionStringName="MyAppDBContext" applicationName="/" />
</providers>
</sessionState>
But it complains the session table doesn't exist. If I create the session table, EF4.1 complains that the DB metadata doesn't match its expectations.