Is .NET 3.5's CompiledQuery slower than normal LINQ queries? Part 2

by Dominic Zukiewicz 31. March 2008 15:33
Updated: This article is 2 of the 2 posts about this problem (Problem AND Solution) The answer to this is definitely ... NO! When a colleague looked over my example, we shared some ideas about what LINQ is actually doing. It turns out that my LINQ version was working faster because it wasn't actually doing anything! By design, LINQ defers all processing until the data is actually used. Being assigned as it was wasn't enough! var q = from c in db.Customers where c.City == "London" select c; This only prepares the query, but no executi... [More]

Tags:

.NET 3.5

Can my private methods be accessed from outside my assembly?

by Dominic Zukiewicz 26. March 2008 09:13
What happens if you try and access a private method in a class? Understandibly, the compiler will kick up a fuss because this breaks the laws of encapsulation. But is it still accessible? Well, the answer is YES, you can still access it from outside the class!! So lets look at what happens in the naive sense: class PrivateMethods { private int ReturnNumber() { return 5; } }   class Program { static void Main(string[] args) { PrivateMethods p = new PrivateMethods(); p.Retu... [More]

Tags:

Framework

EPiCloud > CloudCuckoo > Released!

by Dan Matthews 25. March 2008 15:53
The EPiCloud module that I've been working on for a while is finally ready for release! Due to the EPiServer preferred module naming policy (no EPi.... please!) we had a few thoughts around the office here and one of my colleagues, Alan Bartlett, came up with CloudCuckoo. The name appealed to me because it was rather different and also has mild amusement value. The best part is this though - I have obtained clearance to release the module for FREE on EPiCode! The module and sourcecode is available on EPiCode here. I also finished off the tag moderation part of the plugin, which can be seen o... [More]

Tags:

.NET/C# | EPiServer

Is .NET 3.5's CompiledQuery slower than normal LINQ queries? Part 1

by Dominic Zukiewicz 24. March 2008 19:10
Updated: This article is 1 of the 2 posts about this problem (Problem AND Solution) Today, I looked into using LINQ and SQL together. I read about the CompiledQuery.Compile() method which can speed up queries because of the caching. So I decided to run the queries one by one and view the performance improvement. Unfortuantely, I witnessed that the Compiled version took over 20 times longer to run than the non-compiled. I will ask my Microsoft contacts to clarify this, but in the meantime, if you know why this is, please let me know. Pre-requisites Visual Studio 2008 Add a... [More]

Tags:

.NET 3.5

How to override XML elements and attributes at run-time

by Dominic Zukiewicz 24. March 2008 19:08
Firstly, we'll start with a nice simple bit of XML: <Customer> <FirstName>John</FirstName> <LastName>Smith</LastName></Customer> Think of the situation. You've got your business classes, which serialize to XML. Great! You've named your properties to meaningful names so the XML that comes out is correct for your customer, or you've used the XmlRoot, XmlElement & XmlAttribute attributes to override this, everything is going smoothly. All of a sudden - "We need to modify the XML very slighty so that we have to rename the elements for certain cu... [More]

Tags:

Xml

EPiServer when disconnected from domain controller

by Dan Matthews 20. March 2008 16:38
I've just spent the last few days in a Commerce Server 2007 training course, which was surprisingly interesting. One of the things that leapt out at me was that there are a couple of partners who have worked with Commerce Server 2002 and EPiServer together. It's something that has interested me too and I see even more possibilities with Commerce Server 2007. Hmm... As soon as I got back I got busy getting EPiCloud release ready (and thinking of a nice name for it). In doing that I came across this old error again: "The trust relationship between the primary domain and the trusted domain faile... [More]

Tags:

.NET/C# | EPiServer | Commerce Server

Using IDisposable correctly - finalizers

by Dominic Zukiewicz 20. March 2008 11:36
It sounds easy, implement IDisposable, call Dispose() when you've finished with it, no problem right? Well, even with the advice of the "using" statement, you still can't guarantee that the developer may still forget to do this! So we need to guarantee that they are tidied up! The answer is finalizers, or known to many C++ developers as destructors. Finalizers are a last chance to tidy up any resources when the GC is finally releasing the resources. You do not need to manually clean up managed resources as these are released by the garbage collector anyway, so we need to ensure the unman... [More]

Tags:

MCPD Enterprise Application Developer

by Dominic Zukiewicz 20. March 2008 11:05
Last week, I passed my MCPD Enterprise Application Developer exam, covering: TS Application Development Framework MCTS Web Development MCTS Windows Development MCTS Distributed Applications MCPD Designing & Developing Enterprise Applications The Microsoft Certification route is an excellent qualification scheme that I heavily recommend to any developer wishing to extend their knowledge in any field of application development.

Tags:

Framework

CRM 4.0: Missing Classes in Visual Studio

by Peter Taylor 13. March 2008 16:07
One problem that I have recently come across when attempting to create a custom windows application to interface with Microsoft CRM 4.0 is that some of the classes outlined in the SDK appeared to be missing from the CRM web services, specifically from the CrmService, when I went and added these services to my Visual Studio project as web references. When I then subsequently tried to work through some of the examples outlined in the SDK, this issue would cause errors which would halt the build process, for example: The name 'EntityName' does not exist in the current context The type or names... [More]

Tags:

Microsoft CRM 4.0

EPiCloud floats into view

by Dan Matthews 12. March 2008 09:34
I've updated the B&D EPiLabs site with an updated version of the EPiCloud module. I've added the following features: The top tags are now placed in a META tag and also as a tooltip on the tag entry (this is for SEO) When a new tag is added the top tags for that page are placed in a page property and saved The tag page property is created dynamically if needed The cloud now shows hyperlinks which, when clicked, go to the search page and search for that tag The admin plugin has been 'hooked in' (see screenshot) Plugin saves settings using PlugInSettings ... [More]

Tags:

.NET/C# | EPiServer

What are Predicates and Actions?

by Dominic Zukiewicz 12. March 2008 07:46
.Net Framework 2.0 brought us a cleaner way to deal with multiple items in an Collection. Sometimes the code can be cluttered up with trivial statements, printing information, or selecting certain items because their properties signify the object is useful in some way. Predicates are a way of processing an array of values using a method call. The method call would process a single value (being called once for each index) and then returning a result. Depending on that result, will depend on if the processing continues or exits as the result may have been found. Actions are similar to pr... [More]

Tags:

Framework

A game of cards?

by Dominic Zukiewicz 11. March 2008 22:40
Ever wanted to create a card game, but can't be bothered to create the card graphics?? I know what you mean! Why pay, when Microsoft have already got the cards there for you! When Solitaire is loaded, it calls a convenient little DLL called cards.dll, which stores some Bitmap images of each card. All you have to do is know how to retrieve each one: Firstly, the DLL needs to be kicked into action. Use the method below to retrieve the default width and height of the cards. [DllImport("cards.dll")] private static extern bool cdtInit(ref int width, ref int height); Next we need to r... [More]

Tags:

Drag and drop files into your Windows application

by Dominic Zukiewicz 11. March 2008 15:05
Say you want to build a text editor, and want to drag files onto the program in order to open the file. Is it difficult? NO! Its not as bad as I thought it would be anyway. Here's all you have to do: Set the AllowDrop property for the textbox to true. Add a DragEnter event into the textbox, storing your text. Add a DragDrop event into the textbox, storing your text. In the DragEnter event, we want to change the cursor so the user knows that they are able to do this. But even before that, we have to check that the drag "type" is a file. How is that done? private void tx... [More]

Tags:

SQL Server: Dynamic column lists with UNPIVOT &mdash; Give your support

by Stephen Horsfield 11. March 2008 12:36
Overview Here's another product suggestion I've logged with Microsoft along the same lines as the previous one.  This one is to allow you to dynamically specify the list of columns you want to unpivot.  This might be from a stored procedure parameter or a subquery, either way you can't do it easily at the moment.  Register your support here: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=332512 Detail Current behaviour UNPIVOT (value FOR column_name IN (Col1, Col2, Col3, Col4)) All columns must be known in advance and specified in full. Suggested beh... [More]

Tags:

IT Management | Software Development | SQL Server

SQL Server: Inclusion of NULLs with UNPIVOT &mdash; Give your support

by Stephen Horsfield 11. March 2008 10:54
Overview I've logged a suggestion with Microsoft for support for the inclusion of NULLs when you use the UNPIVOT operator.  Add your support if you think this would be useful: https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=332325 Example Source data ID Col1 Col2 Col3 Col4 1 Value NULL Value NULL Current behaviour UNPIVOT (value FOR column_name IN (Col1, Col2, Col3, Col4)) ... [More]

Tags:

IT Management | Software Development | SQL Server

SQL Server: Fun with column-level auditing

by Stephen Horsfield 10. March 2008 12:35
Overview Auditing the actual changes made to a table can be quite complex, but is often required.  In SQL Server 2008, you can use the new feature Change Data Capture, but in 2005 you have fewer options. Here's an approach using common table expressions, table variables and a nice, big and hopefully fast query! Context click here to view this online and see the code formatted for viewing Suppose you have a data table and an audit table as follows: 1: CREATE TABLE tblToAudit ( 2: pkid int identity(1,1) primary key, 3: col0 nvarchar(20), 4: col1 nvarchar(20),... [More]

Tags:

IT Management | Software Development | SQL Server

Updating properties in code without a republish

by Dan Matthews 10. March 2008 11:22
While working on my EPiCloud module I came across a snag where I wanted to update page properties (definitions) from code without republishing the page. The page property I'm updating is going to change frequently and I didn't fancy having pages of versions which would be confusing for editors. After having a play with 'traditional' page editing and publishing in code I was drawing a blank and was toying with the idea of calling the SQL stored procedures for editing properties, although I didn't want to go there! Before trying to go further I posed my problem to the #epicode IRC channel (see ... [More]

Tags:

.NET/C# | EPiServer

Business and Decision EPiLabs

by Dan Matthews 7. March 2008 09:51
We've been doing some R&D on funky plugins for EPiServer and decided that we'd show you guys what we're up to. Have a look at our new EPiServer labs site: B&D EPiServer Labs Our tag cloud module 'EPiCloud' is the first module I've put on there. (At the moment I've only put the cloud control on the section homepages (News/Events etc) but any page on the site can be tagged.) It already supports features such as: Culture awareness Tag quantity limiting Ability to show tags for page, children or both Moderator approval  We're looking to expand on this with so... [More]

Tags:

.NET/C# | EPiServer

ASP.NET: Event Log in IIS6/Server 2003

by Brad 6. March 2008 11:44
If you want to write to the Server's Event log from ASP.NET you'll first need to tweak some security settings. The first change is easy, however the second took me a while to find. Step One: Grant "Full Control" to the "IIS_WPG" group to the following registry key: HKLM\SYSTEM\CurrentControlSet\Services\EventLog Step Two: One of the security restrictions added to IIS 6 under Windows Server 2003 was much tighter ACLs (Access Control Lists) on the event logs. This restricts what accounts can read and write to the logs (application, system & security). To overcome this you'll ne... [More]

Tags:

ASP.NET AJAX | Microsoft Server 2003

FindPagesWithCriteria without Criteria

by Dan Matthews 4. March 2008 15:34
An EPiServer frustration for me is not being able to grab a 'deep' tree as a PageDataCollection. Sometimes I want to be able to iterate through a collection of all descendants of a page. Ideally I'd want to do a GetChildren with a 'deep' boolean parameter or something, but there isn't one. Trying to use FindPagesWithCriteria is frustrating as if you enter no Criteria then it returns nothing. For now, I've just hacked it with the following code. It works, but I hate it. If you have a better solution please let me know. And yes, I know that I could iterate through GetChildren but that would be... [More]

Tags:

.NET/C# | EPiServer

Powered by BlogEngine.NET 1.5.0.7
Theme by Interakting

Interakting

A full service digital agency offering online strategy, design and usability, systems integration and online marketing services that deliver real business benefits and ensure your online objectives are met.

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar