Tag Archives: C#

ByTrent Jones

Entity Framework Code Only option

.NET 4.0 and VS 2010 introduce a new feature for the Entity Framework called model first.  In addition, you will now be able to have a code only model. Written with POCOs and a simple class derived from ObjectContext and you are on the way…

http://blogs.msdn.com/efdesign/archive/2009/06/10/code-only.aspx

ByTrent Jones

Using Stored Procedures with Entity Framework

Yesterday i was attempting to use a stored procedure with the Entity Framework through the “function import” features and couldn’t get the auto-gen feature to expose the function on the Context.  The stored procedure was returning a scalar value which at this point doesn’t seem to be supported through auto-gen.  Choosing an Entity, however works fine. Further digging this morning led me to this article on the ADO.NET team blog explaining the issues with return types and stored procedures in Entity Framework.  The article also links to another great article showing how to return custom types two ways:  one way through the entity framework itself, the other through the use of extension methods.

ADO.NET Entity Framework Extensions

ByTrent Jones

Forms Authentication and Session Timeout

Ran into an issue on a website where the Session was timing out yet the forms auth ticket was still valid which was causing errors. Here is one solution:

http://dotnethitman.spaces.live.com/blog/cns!E149A8B1E1C25B14!210.entry

The GU also mentions some of this in the post and in digging through all the comments.
http://weblogs.asp.net/scottgu/archive/2005/11/08/430011.aspx

ByTrent Jones

Source Code Outliner Power Toy

This is one of my favorite plug-ins for Visual Studio.  In my opinion it works better than the Alpha drop down at the top of the window.  For those of you that organize your source code this tool will be perfect.

http://www.codeplex.com/SourceCodeOutliner

ByTrent Jones

Property Manager AddIn for private members

Ya, i know, you can type “prop” + tab->tab but i like this better. It will create the public properties for a highlighted list of private members to the clipboard. You can then choose where to paste the results in your code.

For a complete description:
http://www.csharper.net/blog/property_manager_addin_for_visual_studio_2005.aspx

To download the VS 2008 Compatible version:
http://www.csharper.net/blog/visual_studio_2008_add_in_compatibility.aspx

ByTrent Jones

Plugin based development in .NET

Found a brief, useful example of how to implement a simple plug-in based application via .NET today on CodeProject.

http://www.codeproject.com/KB/gadgets/pluginmanager.aspx

ByTrent Jones

Sending and receiving JSON messages from a WCF Service

Here is a sample project which will show you how to send and receive JSON data from a WCF service using three of the most popular javascript libraries.  You can do it without the libraries but why reinvent the wheel.  Also, this is actually a VS2008 Studio Template so just download and drop the file into My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual C#\ and enjoy.

To use the template, goto File\New Project\Visual C# and look to “My Templates” and you should see WCF JSON.

wcf-json Visual Studio 2008 Template