Cloud Foundry: Design and Architecture
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Abel Avram on Jul 15, 2010
Entity Framework Feature CTP 4 recently released updates the Code First programming model with new code conventions and data annotations, and adds two new types, DbContext and DbSet<TEntity>, providing easy entity model setup using Code First.
Code First
The Code First programming model is a way of creating a model by writing the code for the classes whose associated entities are contained by the model. The model is discovered by EF when using appropriate code conventions, and it can be refined using a fluent API or data annotation attributes. An example of using data annotation attributes looks like this:
public class Person {
[Key]
public string SSN { get; set; }
[StringLength(512)]
public string Name { get; set; }
[RelatedTo(RelatedProperty=”Author”)]
public ICollection<Book> Books { get; set; }
}
The [Key] annotation specifies that a property is the entity’s primary key, while [StringLength(512)] specifies the maximum length of a string property. EF CTP 4 recognizes the following data annotations: Key, StringLength, ConcurrencyCheck, Required, Timestamp, DataMember, RelatedTo, MaxLength, StoreGenerated.
Fluent API takes precedence over data annotations which in turn have precedence over code conventions. Other significant Code First updates are:
Productivity Improvements
EF Feature CTP 4 comes with 2 new types: DbContext and DbSet<TEntity>. DbContext is a simplified version of ObjectContext, providing basic functionality for model caching, database provisioning, connection management, and schema creation. An example looks as following:
using System.Collections.Generic;
using System.Data.Entity;
namespace MyDataAccessDemo {
class Program {
static void Main(string[] args){
using (var context = new ProductContext()) {
var food = new Category { CategoryId = "FOOD" };
context.Categories.Add(food);
var cheese = new Product { Name = "Cheese" };
cheese.Category = context.Categories.Find("FOOD");
context.Products.Add(cheese);
context.SaveChanges();
}
}
}
public class ProductContext : DbContext {
public DbSet<Product> Products { get; set; }
public DbSet<Category> Categories { get; set; }
}
public class Product {
public int ProductId { get; set; }
public string Name { get; set; }
public Category Category { get; set; }
}
public class Category{
public string CategoryId { get; set; }
public string Name { get; set; }
public ICollection<Product> Products { get; set; }
}
}
This code is all one needs to write in order to have an entity model created for him, including all underlying plumbing needed to store the model in a database.
Microsoft has not yet specified when EF Feature 4 RTM will be shipped, mentioning only that “we are working to get to an RTM in the earliest feasible ship vehicle.”
Related information: ADO.NET EF CTP 4, EF CTP4 Walkthrough: Code First, Conventions for Code First, Productivity Improvements for the Entity Framework, EF CTP4 Walkthrough: Productivity Improvements.
Introducing SQLFire: a memory-optimized, high performance SQL database
Tutorial: Integrating SQLFire with tc Server and Spring Data
Automating Error Reporting for .NET Applications
Troubleshoot Java/.NET performance while getting full visibility in production
VMware vFabric SQLFire - Test drive the data management system with memory speed, horizontal scalability and a familiar SQL interface
What the article describes is the Entity Framework Feature CTP 4, which is the fourth version of the EF Feature CTP, which contains previews of new features that are in development. EF4 RTM is part of .NET 4.0, which went RTM last April.
Hi Diego, your observation is correct. I edited the article by adding "Feature" to avoid any confusion. Thanks.
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
Andrew Watson talks about the work of the OMG, where CORBA is alive and well (hint: in your car), UML and UML Profiles vs. custom Modeling languages, DDS and other middleware, and much more.
Sohil Shah discusses creating iPhone and Android enterprise mobile applications based on cloud services using the open source platform OpenMobster.
Paul Sanford presents the transformations supported by data throughout its life cycle, and how that can be better done with Splunk, an engine for monitoring and analyzing machine-generated data.
A common “best practice” for unit tests is to only write a one assertion in each test. I intend to question this advice by showing that multiple assertions per test are both necessary and beneficial.
John Rauser presents the architectural and technological evolution of Amazon retail websites starting with 1994 and ending with adopting Amazon Web Services.
Michael Stal discusses system architecture quality, how to avoid architectural erosion, how to deal with refactoring, and design principles for architecture evolution.
Every developer has had to integrate with another system, API or component. Tis article provides strategies to handle the change and for he separating system boundaries.
2 comments
Watch Thread Reply