DCSIMG
December 2007 - Posts - Guy Burstein's Blog

Guy Burstein's Blog

Developer Evangelist @ Microsoft

News

Guy Burstein The Bu

Disclaimer
Postings are provided 'As Is' with no warranties and confer no rights.

Guy Burstein LinkedIn Profile

December 2007 - Posts

סדרת קצרצרים בנושא LINQ to SQL

סדרת קצרצרים בנושא LINQ to SQL

עדלי משיח טרח והכין סדרת סרטוני הדרכה קצרצרים בנושא LINQ to SQL. אז אם אתם מעניינים ללמוד על LINQ to SQL ואין לכם כוח לקרוא מאמר של 30 עמודים, או שאין לכם זמן לראות Webcast במשך שעה שלמה - תוכלו כל פעם להקדיש מספר דקות כדי להכיר עוד פינה של הטכנולוגיה.

כל הכבוד לעדלי על היוזמה!

Service Factory: Modeling Edition - A New CTP for Visual Studio 2008

Service Factory: Modeling Edition - A New CTP for Visual Studio 2008

Service Factory: Modeling Edition 2008

The patterns & practices group has released a new CTP of the Service Factory: Modeling Edition that works with Visual Studio 2008.

Note that this release is only a CTP, and the full release is scheduled for February 2008, around the time Visual Studio 2008 is officially launched.

To get started with the Service Factory: Modeling Edition, you should download the Visual Studio 2008 SDK 1.0 and the Guidance Automation Toolkit (July 2007 Community Technology Preview) and then, download and install the CTP.

Previous posts I've written about the Service Factory: Modeling Edition:

Enjoy!

ADO.Net Data Services Feedback: DataContextServiceProvider Required for LINQ to SQL support

ADO.Net Data Services Feedback: DataContextServiceProvider Required for LINQ to SQL support

After writing my previous posts about ADO.Net Data Services:

I took a little time to write some logic that manipulates data on the client side and applies the changes back to the service.

Starting with adding a new entity:

BlogDataContext ctx = new BlogDataContext("http://localhost:2445/BlogData.svc");

 

Blog blog = new Blog { BlogID = "guy.burstein", BlogName = "My new Blog", Owner = "Guy Burstein" };

ctx.AddObject("Blogs", blog);

 

ctx.SaveChanges();

I got a WebException: "The remote server returned an error: (400) Bad Request.", which means that the Data Service cannot handle my request to add a new entity.

Digging with reflector, I had some insights about the process being taken when the Data Service is being initialized when a request needs to be processed:

public class BlogData : WebDataServiceSomeDataContextHere  >

{

   ...

}

According to the context being provided as the generic argument for the WebDataService class, an appropriate IWebDataServiceProvider is being created.

IWebDataServiceProvider provider = WebDataService<T>.CreateProvider(dataServiceType);

The CreateProvider method check if the dataServiceType is an ObjectContext (Entity Framework context) and creates an ObjectContextServiceProvider. Else, it creates a ReflectionServiceProvider.

if (typeof(ObjectContext).IsAssignableFrom(c))

{

    provider = new ObjectContextServiceProvider(c);

}

else

{

    provider = new ReflectionServiceProvider(c);

}

In order for a data service to be updatable, one of the following must exist:

  • The service context implements IUpdatable, or
  • The related WebDataServiceProvider implements IUpdatable.

The ADO.Net Entity Framework's ObjectContext does not implement IUpdatable, but its ObjectContextServiceProvider does, so building a Data Service with an ObjectContext gives you an update support out of the box. Using LINQ to SQL with a DataContext on the other hand, results in using the ReflectionServiceProvider that has no built in support for IUpdatable operations, and it relies on the data service context to implement it.

Conclusion

Using ADO.Net Entity Framework as the service data context gives you update support for free. If you are using LINQ to SQL, you can implement IUpdatable yourself, as Mike has done here. I think that the product team should consider adding a DataContextServiceProvider class that uses the LINQ to SQL DataContext capabilities for updating the store.

ADO.Net Data Services Part 3 - Querying a Web Data Service and WebDataGen.exe

ADO.Net Data Services Part 3 - Querying a Web Data Service and WebDataGen.exe

This post is part of a series of posts about ADO.Net Data Services, a part of the ASP.Net 3.5 Extensions. In ADO.Net Data Services Part 1 - Building a Simple Web Data Service I had a step by step guide for building a simple web data service, that exposed resources as IQueryable properties of the DataContext. In ADO.Net Data Services Part 2 - Using Service Operations with WebGet I added some Service Operations to the Data Service, and worked with them. In both of the previous posts I used the browser to request data from the Data Service which was very nice, but not useful in real applications. In this post, I will talk about how we can query the Data Service from a client application. This post is a step by step guide for creating a client application that queries the Blog Data Service I build in the previous posts.

1. Open the Blog Data Service from ADO.Net Data Services Part 2 - Using Service Operations with WebGet post.

2. Add a new Console Application to the solution, and add a reference the the client side components for ADO.Net Data Services assembly (Microsoft.Data.WebClient.dll that is one of the assemblies that came with the ASP.Net 3.5 Extensions Preview, and can be found in C:\Program Files\Reference Assemblies\Microsoft\Framework\ASP.NET 3.5 Extensions).

WebDataGen.exe LINQ to ADO.Net Data Services WebDataContext WebDataQuery

Using the WebDataGen.exe tool

3. Generate the client side entities. Open a command windows and navigate to C:\Program Files\Microsoft ASP.NET 3.5 Extensions folder. In order to generate the client classes, we use the WebDataGen.exe tool with the following command:

Webdatagen.exe /mode:ClientClassGeneration
/uri:http://localhost:2445/BlogData.svc /outobjectlayer:BlogEntities.cs

This command queries the metadata of the Data Service from the input uri and generates the entities code in a file called BlogEntities.cs.

Microsoft (R) WebDataGen version 3.5.0.0
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Writing object layer file...

Generation Complete -- 0 errors, 0 warnings

4. Add the BlogEntities.cs code file to the client project. This adds the generated classes to the project and makes them available for use in the client application.

LINQ to ADO.Net Data Services WebDataContext WebDataQuery

WebDataContext and WebDataQuery

5. Query using an untyped WebDataContext. Create an instance of WebDataContext, and pass the url of the data service as a parameter.

WebDataContext ctx = new WebDataContext("http://localhost:2445/BlogData.svc");

Now, in order to query for the list of posts, you can create a query.

var query = ctx.CreateQuery<Post>("Posts");

 

foreach (Post p in query)

{

  Console.WriteLine("{0} posted on {1}", p.Title, p.PublishDate);

  Console.WriteLine(p.Body);

}

The WebDataContext.CreateQuery<T> takes the relative path of the resource we want to query, and returns an instance of WebDataQuery<T> which is IQueryable. This means that only when we first enumerate the results, the query will be translated into a web request and be sent to the Data Service. If we hover the query object while debugging, we can see the URI of the request that will be sent to the service in order to perform the query.

LINQ to ADO.Net Data Services WebDataContext WebDataQuery

6. Query using the generated WebDataContext. One of the classes that WebDataGen.exe has generated is BlogDataContext, which is very similar to the approach taken by the LINQ to SQL DataContext and Entity Framework's ObjectContext.

public partial class BlogDataContext : Microsoft.Data.WebClient.WebDataContext

{

    public BlogDataContext(string uriString) : base(uriString) { }

    public BlogDataContext(System.Uri baseUri) : base(baseUri) { }

 

    public Microsoft.Data.WebClient.WebDataQuery<Blog> Blogs

    {

        get { return CreateQuery<Blog>("Blogs"); }

    }

 

    public Microsoft.Data.WebClient.WebDataQuery<Post> Posts

    {

        get { return CreateQuery<Post>("Posts"); }

    }

 

    public Microsoft.Data.WebClient.WebDataQuery<Category> Categories

    {

        get { return CreateQuery<Category>("Categories"); }

    }

}

It is a partial class that inherits from the "untyped" WebDataContext and exposes a strongly typed WebDataQuery<T> objects for the data service resources as properties. The constructors takes the base URL of the service as a "connection string".

In order to use the typed BlogDataContext, we can write:

BlogDataContext ctx = new BlogDataContext("http://localhost:2445/BlogData.svc");

 

var query = ctx.Posts;

 

foreach (Post p in query) { ... }

7. Use a more sophisticated query. Since the WebDataQuery is an IQueryable, you can use it's extension methods in order to add operators to the query such as:

var query = ctx.Posts.Where(p=>p.BlogID == "bursteg");

which results in the following URI for querying the data service: http://localhost:2445/BlogData.svc/Posts?$filter=(BlogID)eq('bursteg')

var query = ctx.Posts.OrderBy(p=>p.PublishDate).Skip(2).Take(2);

which produces: http://localhost:2445/BlogData.svc/Posts?$orderby=PublishDate&$skip=2&$top=2

and you get the idea...

LINQ to ADO.Net Data Services

8. Use LINQ to ADO.Net Data Services to query the service. Again, since the WebDataQuery is an IQueryable, you can use LINQ syntax to query it:

var query = (from p in ctx.Posts

            where p.BlogID == "bursteg"

            orderby p.PublishDate

            select p).Skip(2).Take(2);

Conclusion

ADO.Net Data Services provides a rich mechanism for querying a data service from a client application. We start by creating the WebDataContext, and using WebDataQuery objects to perform queries. The WebDataGen.exe tool can generate the client side entities for us.

Enjoy!

LINQ to SQL Session @ Developer Academy 2 - Video is now Available

LINQ to SQL Session @ Developer Academy 2 - Video is now Available

LINQ to SQL Video

On November 27th, 2007 I gave a session about LINQ to SQL at the Developer Academy 2 (The Israeli developers conference).

You can download the presentation and video from My Presentations page. Although the presentation was given in Hebrew, you can benefit from the demos that were given in C#...

Enjoy!

ההקלטות מ- Developer Academy 2 עלו לאתר

ההקלטות מ- Developer Academy 2 עלו לאתר

ניתן להוריד אותם מכאן.

ADO.Net Entity Framework Tools: Stored Procedures

ADO.Net Entity Framework Tools: Stored Procedures

The new ADO.Net Entity Framework Tools CTP contains improvements that allows us to map entities to Stored Procedures in the designer, and create Function Imports. In this post, I show how to do that with the designer.

Creating the Initial Entity Data Model

Create a new project, and add a new Entity Data Model (EDM) for your data store. In this sample I am using the BlogSchema that I've used in previous posts, so I named my model BlogModel.edmx.

In the Entity Data Model Wizard, choose Generate From database option, select the database connection to use, and then select the database objects you want to import to the model. This is where you select the stored procedures to import. In this sample, I selected the Posts table and stored procedure for CRUD operations.

ADO.Net Entity Framework Tools: Stored Procedures

The new model is now created and we can see that by default, the Post entity is mapped 1:1 to the Posts table.

ADO.Net Entity Framework Tools: Stored ProceduresADO.Net Entity Framework Tools: Stored Procedures 

Map Insert, Update and Delete Functions to Entities

The new Mapping Details Pane in CTP2 of Entity Framework Tools has a new button, that lets us map entities to functions.

ADO.Net Entity Framework Tools: Stored Procedures

This buttons opens the Functions Mapping display. In order to map a function to an entity operation (Insert, Update or Delete), choose it from the list of available functions.

ADO.Net Entity Framework Tools: Stored Procedures

This will expand the node for the mapping between the Stored Procedures parameters and the entity fields.

ADO.Net Entity Framework Tools: Stored Procedures

By default, the mapper maps parameters to the entities fields by their names automatically, but if there is not match, you can select a fields manually to apply the mapping.

If the stored procedure updates values we want to write back to the entity, like when the PostID is generated by the database and we need to assign the new value back to the entity, we can use the Result Column Binding, and map the new value to an entity column.

ADO.Net Entity Framework Tools: Stored Procedures

Notice the arrows in the mapping details. You can see that values go from the entity to the parameters, and output parameters go back to the entity.

Map Query Functions (Create Function Import)

In order to map a query stored procedure to a Function Import, locate the query stored procedure in the storage model, and use the Create Function Import options from the context menu.

 ADO.Net Entity Framework Tools: Create Function Import

This will open up a dialog that lets you name the Function Import, and choose a return type. In this sample I named the Function Import GetPosts and set its return type to be a collection of Posts.

ADO.Net Entity Framework Tools: Create Function Import

This will add a new Function Import to the model.

ADO.Net Entity Framework Tools: Create Function Import

Using it in Code

Now that we have all our functions mapped, we can write some code against them.

BlogEntities ctx = new BlogEntities();

 

// Use the function import to get a list of posts

foreach ( Posts p in ctx.GetPosts() )

{

  if (p.Title.Contains("guy"))

  {

    ctx.DeleteObject(p);

  }

  else

  {

    // Update the properties of the posts.

    p.Body += " was recently edited";

  }

}

 

// Create a new Post.

Posts newPost = new Posts { BlogID = "bursteg", Title = "New Post", Body = "This is a new post!" };

ctx.AddToPosts(newPost);

 

ctx.SaveChanges();

In this code, I create a new instance of the ObjectContext (BlogEntities), and use the GetPosts Function Import to get a list of posts. Then I perform my business logic that deletes or updates posts. I add a new post and save my changes back to the store. Notice that the Function Import is mapped to a new method called GetPosts in the ObjectContext level, and the changes I have made to the object states and the logic I wrote here has nothing to do with the fact I am using stored procedures. I write my logic as I would do anyhow, and the only mapping knows about using stored procedures for applying the changes back the store.

Enjoy!

ADO.Net Data Services Part 2 - Using Service Operations with WebGet

ADO.Net Data Services Part 2 - Using Service Operations with WebGet

This post is part of a series of posts about ADO.Net Data Services, a part of the ASP.Net 3.5 Extensions. In ADO.Net Data Services Part 1 - Building a Simple Web Data Service I had a step by step guide for building a simple web data service, that exposed resources as IQueryable properties of the DataContext. I this post, I will add some Service Operations to the Data Service.

1. Open the Blog Data Service fService Operations rom Part 1. If you haven't had a chance to follow ADO.Net Data Services Part 1 - Building a Simple Web Data Service - this is you chance!

2. Add a Table Valued Function to your database (I will explain why I chose Table Valued Functions and not Stored Procedures later in this post). Run the following script in order to create the PostsByCategory sample Table Valued Function.

create function PostsByCategory

(

    @CategoryID int

)

returns table

as

return

    Select p.*

    From   Posts as p

    Join   PostCategories as pc

    On    p.PostID = pc.PostID

    Where  pc.CategoryID = @CategoryID

3. Add the Table Valued Function to the LINQ to SQL Data Model. Open the LINQ to SQL Designer, and drag the PostsByCategory function from the Server Explorer to the design surface.

ADO.Net Data Services WebGet

This will add a new method, with a signature that matches the parameters of the database function.

ADO.Net Data Services WebGet

Click on this method, and in the properties pane, change the return type of the function to be a list of Posts instead of the Auto-Generated Type.

ADO.Net Data Services WebGet

Confirm the warning message Visual Studio shows up. It tells you that the auto generated type will be removed from the Model.

ADO.Net Data Services WebGet

Click Save and let Visual Studio generate the code for the data entities and the data access. If we now open the generated code, and look for the PostsByCategory method in the DataContext, we will see the following code:

[Function(Name="dbo.PostsByCategory", IsComposable=true)]

public IQueryable<Post> PostsByCategory([Parameter(Name="CategoryID", DbType="Int")] int categoryID)

{

  return this.CreateMethodCallQuery<Post>(this,
        ((MethodInfo)(MethodInfo.GetCurrentMethod())), categoryID);

}

Notice that this method is mapped to a Table Valued Function using the Function Attribute. the IsComposable=True tells LINQ to SQL runtime that this is indeed a Table Valued Function and not an ordinary Stored Procedure, which means that it can use it as part of the query sent to the database, and not perform additional filtering in memory. This is the fact that the generated code returns a IQueryable<Post> and not IEnumerable or something else. As you probably remember, ADO.Net Data Services works with IQueryable resources.

4. Add this method as a Service Operation. Open the Web Data Service code, and add the following method.

public class BlogData : WebDataService<BlogDataContext>

{

  [WebGet]

  public IQueryable<Post> PostsByCategory(int categoryID)

  {

    return this.CurrentDataSource.PostsByCategory(categoryID);

  }

}

This method is a public method that returns an IQueryable<Post>. It is decorated with the [WebGet] Attribute, which tells the ADO.Net Data Services runtime to expose this method as a Service Operation when building the metadata of the service.

As an implementation, it uses the CurrentDataSource property of the service, that returns the instance of the DataContext that was created in this session / scope, and calls the PostsByCategory method on the DataContext that we created in the previous step.

5. Enable access for the Service Operation. As we already know, ADO.Net Data Services do not allow accessing the service resources without explicitly allowing this in the code. Same goes for Service Operations. In the InitializeService method, similar to the way we allowed accessing the resources, we now allow calling the service operations:

public static void InitializeService(IWebDataServiceConfiguration config)

{

  config.SetResourceContainerAccessRule("*", ResourceContainerRights.All);

  config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);

}

6. Run and test the service. If you run the project and navigate to the service (http://localhost:2445/BlogData.svc) you'll see the following output:

ADO.Net Data Services WebGet

This output does not contain anything about the Service Operations, and they need to be called directly. To call a Service Operation, we should add the name of the operation with it parameters: http://localhost:2445/BlogData.svc/PostsByCategory?categoryID=2, which now returns the desired output.

ADO.Net Data Services WebGet

Feedback:

Although it was very easy to do, I think that adding the method to the web data service could have done easier. Currently, there is no way to add Service Operations directly from the DataContext, which is only being searched for IQueryable properties. It would be nice to add a Table Valued Function to the Model, let Visual Studio generate a method that returns an IQueryable, and let the service work with it seamlessly.

Enjoy!

ADO.Net Entity Framework: eSqlBlast Tool for E-SQL Queries

ADO.Net Entity Framework: eSqlBlast Tool for E-SQL Queries

E-SQL, the Entities Query Language that comes as part of ADO.Net Entity Framework is a very rich language that queries in terms of the your application's Entity Data Model (EDM).

Zlatko Michailov, Program Manager for Entity Services has posted about the eSqlBlast Tool for E-SQL Queries, and I though to give it a try.

I downloaded the eSQLBlast Code, and opened it in Visual Studio 2008.

This solution contains 5 projects / assemblies:

  • Microsoft.Samples.Data.eSqlBlast.Language.dll - a general script processing library. It defines an interface for declaring a language syntax, and implements a common script parser.
  • Microsoft.Samples.Data.eSqlBlast.Core.dll - the only assembly that interacts with Entity Framework.
  • Microsoft.Samples.Data.eSqlBlast.CmdShell.exe - a command-line executable built around the core DLL.
  • Microsoft.Samples.Data.eSqlBlast.WebShell - an ASP.NET web site that exposes the core functionality against a predefined set of models.
  • Microsoft.Samples.Data.eSqlBlast.WinShell.exe - standalone GUI executable that is designed for interactive ad-hoc Entity SQL query authoring.

I ran the WinShell application, used the Add Files button to select the mapping files (.csdl, .ssdl and .msl) of a model I've created earlier, and connected to the model.

Note that I had to manually edit the Provider Connection String and provide the name of the Server and the Database.

 eSQLBlast E-SQL

Rendered my model in the Model Tab:

eSQLBlast E-SQL

Than, in the Query tab, I typed my E-SQL query. Notice that there is an intellisense will writing the query!

eSQLBlast E-SQL 

and finally, got my results in the Results Tab.

eSQLBlast E-SQL

Nice tool that helps writing E-SQL statements but also helps learning how to use the Entity Framework.

Enjoy!

Smart Client Software Factory for Visual Studio 2008

Smart Client Software Factory for Visual Studio 2008

Smart Client Software Factory for Visual Studio 2008

I've written in the past about Software Factories Support for Visual Studio 2008, and mentioned that currently there is no support for Smart Client Software Factory for Visual Studio 2008.

During the time that post was written, project Acropolis was alive and there were no plans to enable working with CAB and Smart Client Software Factory in Visual Studio 2008. Recently, when project Acropolis was stopped and the Composite WPF started instead, the plans were changed. According to Glenn Block, the team is now working on supporting Smart Client Software Factory for Visual Studio 2008. We can expect this support in January or February.

If you are want to use Smart Client Software Factory with Visual Studio 2008 today, follow the instructions here (written originally for Beta 2 but should work the same).

Enjoy!

איך מגיעים אל הבלוג שלכם מגוגל?

תותח בלוגים מאד קל להגיע לבלוג של יוסי כשמחפשים "סקס בכללית" בגוגל. זה קליט, משעשע וזוכרים את זה בקלות.
ניסיתי לחפש מה הדרך להגיע אלי לבלוג עם כל מיני מילות חיפוש. הנה מה שמצאתי:

בדקתם פעם איך אפשר להגיע לבלוג שלכם?

 

ADO.Net Data Services Part 1 - Building a Simple Web Data Service

ADO.Net Data Services Part 1 - Building a Simple Web Data Service

This post is part of my Get Started with ADO.Net Data Services post series. This post is a step by step guide for building a Simple Web Data Service for the Blog database I posted in the last post.

1. Create a new standard ASP.Net Web Application. Notice that there is no special project template for a Web Data Service, and later we will see the new item template. In this guide, I called my web application BlogWebApp.

image 

2. Create the application Data Model. One of the improvements of ADO.Net Data Services December CTP is that the data model doesn't have to be an Entity Data Model (ADO.Net Entity Framework Model), but it can be any class that has properties that implement the IQueryable interface. The LINQ to SQL Data Context is a great candidate for begin a data mode for an ADO.Net Data Service, since it has public properties of Table<T> that implement this interface.

Add a new item of LINQ to SQL classes to the application. In this guide, I called my model Blog.dbml.

image 

In the Server Explorer, add a new connection to the blog database.

image

After the connection has been established, expand the connection's tree node, and drag the tables to the LINQ to SQL Designer.

Linq to SQL Designer

3. Create the Web Data Service. Add a new ADO.Net Data Service item to the project. This is the new item template that is installed as part of the CTP of ADO.Net Data Services. in this guide I called this service BlogData.svc.

image

Creating this data service adds a new item to the project, and opens the service for editing.

4. Edit the Web Data Service. First, replace the template comment in the class definition

/* TODO: put your data source class name here */

with the name of the data provider. In this guide, since we are using LINQ to SQL, we will use the BlogDataContext class as a provider. This class is one of the classes that Visual Studio has generated when we created the LINQ to SQL model.

public class BlogData : WebDataService< BlogDataContext >

{

    public static void InitializeService(IWebDataServiceConfiguration config)

    {

    }

}

5. Run the project, and enable debugging if the dialog appears. The ASP.Net Web Server starts and the Internet Explorer with it, navigating to the data service: http://localhost:2445/BlogData.svc/. Notice that the output returns no results, and the output looks like:

image

The reason is that as of the December CTP of ADO.Net Data Service, Access Control was integrated into the Data Services, not allowing anyone to view the metadata or the data itself of any resource, without explicitly allowing it. I will not dive into this access control features in this post, and will dedicate a post talking about it.

6. Allow all the resources to be readable. Edit the Web Data Service, and in the InitializeService method, use the configuration parameter to do this.

public static void InitializeService(IWebDataServiceConfiguration config)

{

  config.SetResourceContainerAccessRule("*", ResourceContainerRights.AllRead);

}

This call gives all the resources (the public IQueryable properties of the DataContext) the ability to be seen via the service.

7. If you now run the service (http://localhost:2445/BlogData.svc/) again, you can see the following output:

image

If you cannot see the output in the above way, go to Tools->Internet Options-> Content Tab. Click the Settings button in the Feeds section, an uncheck the Turn on Feed Reading View option.

Notice that some elements contain the href attribute with an additional URL. We can use it to navigate through the data:

image

image

  • Show this blog's 3rd post.

image

And so on...

Enjoy!

Getting Started With ADO.Net Data Services (Project Astoria)

Getting Started With ADO.Net Data Services (Project Astoria)

Getting Started With ADO.Net Data Services

Now that Visual Studio 2008 RTM is here, the compatible ADO.Net Entity Framework Beta 3 bits, and now the December CTP of ADO.Net Data Services, its time to deep dive into it.

I'll take the next few posts to play around with ADO.Net Data Services to create a Data Service for my Blog Schema. You're more than welcome to join me...

To get started, you can download the BlogSchema.sql script and create the initial database for the next posts.

Getting Started With ADO.Net Data Services

Enjoy!

ADO.Net Data Services (Project Astoria) for Visual Studio 2008 RTM is Available

ADO.Net Data Services (Project Astoria) for Visual Studio 2008 RTM is Available

ADO.NET Data Services

ASP.Net 3.5 Extensions Preview provides new functionality being added to ASP.NET 3.5 and ADO.NET in 2008. This release delivers a set of new features that target:

  • Enabling High Productivity Data Scenarios - including MVC, Entity Framework, ADO.NET Data Services and dynamic data
  • Supporting Test Driven Development - including a powerful and extensible MVC framework
  • Creating the best server for Rich Clients - including Ajax history support and Silverlight controls for ASP.NET

Specifically, what I was waiting for - is the new bits of Project Astoria, which was renamed to ADO.Net Data Services.

ADO.NET Data Services

ADO.NET Data Services provide new services that find, manipulate and deliver data over the web using simple URIs. Benefits include an easy and flexible way to access data over the web, while enabling the separation of presentation and data access code.

Download the ASP.Net Extensions Preview from here, after reading this readme file. Then, you can follow this quickstart, and discuss about ADO.Net Data Services in this forum. Stay tuned for more updates in the Project Astoria Team Blog.

Enjoy!

ADO.Net Entity Framework Entity Designer - Update Model From Database

ADO.Net Entity Framework Entity Designer - Update Model From Database

In CTP 1 of the ADO.Net Entity Framework Tools, once you generated a model from an existing database, and selected the database object to import into that model, you could not import any additional objects using the designer. You had to manually edit the mapping files that could have caused some errors in the model since its schema is very rich and therefore more complicated.

In the CTP 2 of the Entity Framework Tools, a new feature was added: Update Model From Database, that allows you to:

  • Add new objects from the database (tables, views and stored procedures) to the storage mapping part of the model.
  • Remove existing objects from the storage mapping.
  • Update the storage mapping according to changes made in the database, since the storage mapping was generated.

To update the model from the database, click the Storage Model Node in the Model Browser, and choose the option Update Model From Database.

Update Model From Database

This will open a dialog that lets you define which database objects you want to add / update or remove from the storage model.

Update Model From Database

Enjoy!

More Posts Next page »