Browse by Tags
All Tags »
Development (
RSS)
The LINQ To SQL designer-generated classes contain 3 different ways to implement validation based on property values. Two of these are internal, in the form of partial methods, and one is external in the form events on the domain classes themselves. However, the timing around these differs slightly, so I'm going to examine them according to the timing. To look into these approaches, I'm using the Customers table from Northwind. I've got it on my LINQ To SQL designer, and I've implemented...
I posted earlier about how to use enums in LINQ To SQL , and I spoke about why I think enums are useful. The only problem with this approach was that you had to create the enums by hand, even if you had the same data sitting in a lookup table. If you were at my recent Code Generation with T4 Chalk 'n Talk at Tech Ed South Africa, you would have seen me generate enums automatically from the database, which is what we're going to do below. Note: If you're not familiar at all with T4, check...
I don't know about you, but I'm quite a fan of using Enumerations (Enums) in my apps. I'm all for more readable, more explicit code because I think it helps a lot with maintainability, and enums help with that. I'd much rather read a line of code that says: customer.CustomerType = CustomerType .Good; than customer.CustomerType = 1; Of course, it means you also get Intellisense when you're writing the code. Another advantage is that enums, which are usually lookup types and very...
In this video, I cover how to add Intellisense functionality to your custom language service . The video covers Statement/Word Completion and QuickInfo. I can see this coming to a LOLCode Language Service near you! Here's a screen shot: Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
I've been a bit bogged down, so I haven't noticed some of the recent Visual Studio eXtensibility (VSX) How Do I videos going live. I see that How Do I: Work With Other Combo Box Types? is now available. It's a follow on to an earlier video which covered adding a standard combo box, and it includes adding an Indexed Combo, a Most-Recently Used (MRU) Combo (like the Find combo in Visual Studio) and a Dynamic Combo (Like the Zoom combo in most PDF viewers). Here's a screenshot: Share...
I've made use of the Log property on the DataContext class in a few of my LINQ To SQL posts . Usually, it's been in a console application, and we're just looking at the SQL output in the console window, so we use: dataContext.Log = Console .Out; However, in a web application, this won't help. If you want to see the output of your SQL directly in the page, you can use: System.IO. StreamWriter httpResponseStreamWriter = new StreamWriter ( HttpContext .Current.Response.OutputStream);...
This week's Visual Studio eXtensibility (VSX) video is up. It covers adding a dialog page to configure your Visual Studio Integration Packages . It does this by adding a section into the Tool..Options window. Below is a screenshot: Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
I've had a lot of traffic to a post from a while back on " Make Your Web Service Proxies Return List<T> Using RegEx (And The Regulator) ". In the post, I was converting the arrays that were being generated by the web client proxy into List<T> (Or List(Of T) if you speak VB) and I was using RegEx to do. It was a bit tricky because I had to ignore the object[] arrays that were being used internally in the proxy class and it was a bit kludgy because it had to be run by hand...
User Defined Functions, or UDFs, provide method-like functionality with TSQL statements. If you've not used them before, you can read more here . In this post I'm going to assume you've got some basic knowledge of UDFs and show how to use them in LINQ To SQL. First up, you can go and create a simple UDFs. I'm using the tools in Visual Studio to create my UDF but of course you can use Management Studio. My very simple UDF appears as follows: CREATE FUNCTION dbo.SimpleLookup ( @SomeInt...
Udi Dahan has an interesting article on the IASA on sprinkling some common sense and some age-old wisdom into new "cutting-edge" thinking. Check it out at Fear Those Tiers Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
One of the features of LINQ queries is Deferred Execution, which Charlie Calvert discusses here with some great examples . This feature can be used to let you create a shared function to handling adding specific functionality to all queries for a specific type. For instance, if we have a simple Northwind DataContext like the following: then, if we want to write a simple query like the following to find all customers who live in cities starting with an 'L' (or perhaps a less arbitrary query...
This week's VSX video is on adding commands and controls into the Visual Studio environment . It's a modified version of the VS 2005 version of the video that was up on the site before, more tailored around Visual Studio 2008, including using VSCT files for the command placement. Here's a screenshot: Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
I've blogged before about how LINQ To SQL actually requires the same careful design and development practices as other OR/M frameworks (see for instance my post on LINQ To SQL performance ). Part of this involves being aware of when and how calls to the database are executed, and with this is mind I found an interesting sample in the DinnerNow .net 3.5 reference sample application: public bool UpdateOrderStatus(DinnerNow.Business.Data.RestaurantOrder restaurantOrder, string status, Guid WorkflowId...
I mentioned in a post a little while ago about the various LINQ To projects I had seen, but Charlie Calvert has a much more complete list up here . It includes the following LINQ Providers: LINQ to Amazon LINQ to Active Directory LINQ to Bindable Sources (SyncLINQ) LINQ over C# project LINQ to CRM LINQ To Geo - Language Integrated Query for Geospatial Data LINQ to Excel LINQ to Expressions (MetaLinq) LINQ Extender (Toolkit for building LINQ Providers) LINQ to Flickr LINQ to Google LINQ to Indexes...
I blogged a while ago about how I'm not comfortable with using a base class that all of your pages inherit from in ASP.Net. In .net 1.x this was really the only way to enforce behaviour and share functionality but it meant all of the developers on the team had to remember to do it, and it was a manual task. There are ways around this, like overriding the default templates in Visual Studio . Of course, you can still choose to use a base page class in ASP.Net 3.5, one that inherits from System...
More Posts
Next page »