Alex Rivera | Logout

EF with Azure - Mixing SQL Server and Windows Azure Storage

Asked 2011-09-28T08:53:37.890
11

I want to use two different data sources in my Azure project:

  • a SQL Server that contains basic partial info regarding an item (allows indexable data and spatial search)
  • a Windows Azure Storage that contains full remaining info regarding an item (retrieved by key)

In this way I can combine the powerful of SQL Server with the easy scalability of Windows Azure Storage.

Imagine this Domain POCO class:

class Person
{
   string Id { get; set; }
   string Name { get; set; }
   byte[] Picture { get; set; }
   string Biography { get; set; }
}

I would like to use Entity Framework with fluent mapping to let EF understand that the properties Picture and Biography must be loaded from Windows Azure Storage (table, blob) instead of SQL Server (possibly Lazy loaded).

There's a way with EF (or NHibernate) to do this or I have to implement my own ORM strategy?

Thanks

Edit
Report

1 Answer

6

I don't think you can let EF know about Azure storage but you can map only necessary properties to a specific table. For example,

 modelBuilder.Entity<Person>().Ignore(p => p.Picture); 

So assuming that you have a repository class for your Person class, what you want can be easily achieved by filling the repository class with Azure storage API and EF.

answered 2011-09-28T22:01:18.943

Your Answer