Feeds:
Posts
Comments

Archive for July, 2009

Great primer on sending email in .NET, with code snippets.

Some 15 years later things have become quite a bit easier. Sending an e-mail is as straightforward as calling a few basic library functions and .NET of course includes a solid implementation.

via Using C# and .NET to send an e-mail through SMTP | Martijn’s C# Programming Blog.

Advertisements

Read Full Post »

Find yourself just needing the darn data rather wasting time with lazy this and that? Give .Include (or .Expand I believe fora data service query) a try.

If you want to do eager loading with the Entity Framework it is generally really easy, you simply write something like this:

var results = from post in ctx.Posts.Include(“Comments”)
where post.Author.EmailAddress == “alexj@microsoft.com”
select post;

via Meta-Me : Tip 22 – How to make Include really Include.

Read Full Post »

This looks very useful for anyone (poor wretch) wrestling with the Entity Framework.

EdmGen2 is a command-line tool for the Microsoft ADO.NET Entity Framework. The tool can be used as a replacement for the EdmGen.exe tool that ships with the .Net framework 3.5 SP1. EdmGen.exe can only read and write the CSDL, SSDL & MSL file formats. However, EdmGen2.exe can read and write the EDMX file format used by the Visual Studio design tools. Additionally, EdmGen2.exe can translate between EDMX and CSDL, SSDL & MSL formats, and the source code can act as examples on using the tooling APIs defined in the System.Data.Entity.Design assembly.

via EdmGen2.exe – Home.

Read Full Post »

After inquiring on the official forums about new features in Entity Framework 4.0 around join tables this is what I heard back. In short, no new news. 😦 Which is too bad. Our model doesn’t really model entities until we have some way of hiding the join tables or otherwise demoting them to second-class status.

Your understanding is correct, and, no, there aren’t any substantial additional workarounds in EF4. One of the fundamental problems when you have additional properties on your join tables is that you still need some mechanism to access those properties. So if they were truly hidden, that would cause other difficulties. Our current thinking is that in some future release we’ll not hide them per se, but we will provide mechanisms to make it easier to have a collection or reference that represents a “double-hop” from one entity to the join-table-entity and then on to the entity or entities on the other side. You can simulate some of this yourself now by creating a property on your entity which is of type IEnumerable or something like that where the getter does the double hop, but of course that doesn’t help you when it comes time to do a linq query across both hops or that kind of thing.

– Danny

via Join Table Hiding Improvements in EF4? Workarounds?.

Read Full Post »

Quick overview of the alternatives for querying using ado.net data services.

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

var query = (from p in svc.Posts
where p.PostID > 3
orderby p.PublishDate
select p).Skip(2).Take(2);

via Querying using DataServiceContext and DataServiceQuery – linyusen的专栏 – CSDN博客.

Read Full Post »

My service is broke-a$….er I mean my friend is having issues with his code and this is the link I sent him.

By default, Data Services don’t return information on what’s wrong when you try to execute some code, for example an update, against it. This is understandable: if you open up a data service on the web, you shouldn’t be returning all important information about entities in the underlying model.

However, when developing a Data Service, it might be handy to get a little more information than just “An error occurred while processing this request”. Here’s how to achieve this…

via Snowball – The Blog – Debugging ADO.NET Data Services.

Read Full Post »

ADO.NET Data Services provides filtering options for free.

What can go in a $filter? The most basic thing to do is to test properties of the resources we’re returning, which you can access simply by name, like we have done above. Literals for things like strings and numbers use the same syntax as in the key portion (see my last post and the original URL post for more details).

via Marcelo’s WebLog : $filter Query Option in ADO.NET Data Services.

Read Full Post »

Older Posts »