Archives
-
Using New ADO.NET Data Services Functionalities
In order to use the new functionalities (count, projections, server paging, for instance) supplied by version 1.5 of ADO.NET Data Services (see my previous post), you must explicitly enable them on the service side.
-
ADO.NET Data Services Update Released
A new version of the ADO.NET Data Services API was released, and you can get it from here, for the Windows 2000, Windows Server 2003, Windows XP, Windows Vista and Windows Server 2008, and from here, for Windows 7 and Windows Server 2008 R2.
-
HTML 5 Support in IE8
A nice post: IE8 and HTML 5
-
Nested Master Pages
In ASP.NET 2.0+ you can have nested master pages. In Visual Studio 2008, the editor even knows how to handle them properly.
-
ListBoundField and ResourceBoundField
Following my previous post on the ForeignKeyBoundField, here are some more templates for your GridView or DetailsView controls: ListBoundField and ResourceBoundField.
-
ForeignKeyBoundField
When working with GridView and DetailsView controls, we must specify the columns we want to include, by adding field templates to the Columns and Fields collections. These field templates are bound to a specific property of a data source, which, typically, comes from a database table.
-
New Version of Visual NHibernate
A new version was released: 2.0.9.1018. Some of my suggestions have been implemented, more to come (I hope!). You can contribute by giving feedback at the forum, which is located here.
-
Security Lessons from How Windows Live Uses ASP.NET MVC
Nice whitepaper, available here.
-
Dynamic LINQ
Updated: Dynamic LINQ in an Assembly Near By
-
Visual NHibernate
The guys at Slyce Software have released Visual NHibernate Beta. It is still far from final, but it looks promising. You can get it from here, there are also some screenshots.
-
Windows Identity Framework Released
Good news: WIF was released today!
-
Debugging ADO.NET/WCF Data Services
-
ADO.NET/WCF Data Service Interceptors
-
NHibernate 2.1.1 Released
Get it here.
-
Number Parsing in JavaScript
How many times did you have this in your code:
-
Microsoft Sync Framework SDK 2.0 Released
-
ADO.NET Data Services and NHibernate
Update: this is based on the old NHContrib LINQ provider; the current one, on the NHibernate core, does not have an NHibernateContext class. Also, ADO.NET Data Services are now called WCF Data Services. For additional information, please read this post.
-
Manually Indexing an Entity with NHibernate Search
Updated: thanks, Ayende!
-
Finding Dirty Properties in NHibernate
Sometimes there may be a need for finding out if a specific entity, or a property of that entity, was changed, or, better yet, the original value for that property.
-
.NET Serializers, part 2
There were some things left (well, a lot, actually) from my previous article on .NET serializers. One of these things was the ability to have serializers call specific methods before or after serialization. This can be achieved in two ways:
-
.NET Serializers
UPDATED for .NET 8
-
Generating a Unique Identifier for Each Page Instance
Sometimes there may be a need for identifying each page instance univocally. One ocasion may be, for example, if we want to store something in a session which is specific to a certain page.
-
Custom Binding With EntityDataSource
Here's a common scenario: you are using an EntityDataSource control which you are binding to a data control, perhaps a ListView, DataGrid, DataList, Repeater, or GridView. The problem is, you want to do some custom binding. This happens, for example, when viewing a master-detail relationship.
-
New Version of AJAX Control Toolkit Released
Version 3.0.30930 is out. This release includes two new controls:
-
Detecting Chrome Browser in ASP.NET
ASP.NET comes with a browser capabilities database (BCD), which describes the capabilities of known browsers. This database is usefull for control developers that want to take advantage on different browser capabilities. Of course, more recent browsers are not listed on that database, simply because they did not exist at the time ASP.NET 2.0 was released (versions 3.0, 3.5 and 3.5 SP1 don't add anything new), and, specifically, Chrome is not on that list.
-
Data Annotations Property Validator for ASP.NET
Entity Framework, LINQ to SQL and ASP.NET MVC support Microsoft's new validation API, which you can find on System.ComponentModel.DataAnnotations. It basically consists on attribute classes, inherited from System.ComponentModel.DataAnnotations.ValidationAttribute. It is very easy to define your own, although Enterprise Library, xVal and Spring.NET validations are considerably power powerfull.
-
INotifyPropertyChang{ed,ing} and NHibernate
(Updated: thanks, Tom!)
-
NHibernate Image User Type
Supose you want to have in your domain model a property which is of type System.Drawing.Image. On SQL Server, you would map this as a column of type IMAGE, and on your domain model you would define it like this:
-
AntiXSS 3.1 Released
New version, 3.1, was released yesterday. You can get it from here.
-
Thread Synchronization in .NET
This comes after my last post Multi-threading in .NET. There are several synchronization mechanisms you can use in your .NET applications, so choosing among them must be done wisely.
-
Multi-threading in .NET
In .NET 2.0+, if you want to have something run on another thread, you have a number of choices:
-
Developing SharePoint Applications Guidance Released
August release is available at http://www.microsoft.com/downloads/details.aspx?FamilyId=91f3c22c-8be7-4721-9449-84f699337d55&displaylang=en.
-
Set Default Interceptor Unity Extension
With Unity, it is quite easy to implement an extension that automatically sets the appropriate interceptor for each registered type.
-
Using ASP.NET Providers in Non-ASP.NET Applications
ASP.NET developers are most likely familiar with the rich provider-based modules supplied with ASP.NET. These are the Role Provider, the Membership Provider, the Profile Provider, the Personalization Provider, the Web Events Provider, the Site Map Provider, the Session State Provider and the Protected Configuration Provider. For detailed information on all of these modules, you should read this. The providers that I will talk about are the Role, Membership and Profile, which are the ones that may be used in non-ASP.NET applications.
-
Fluent NHibernate 1.0 Released
-
Blog Post Hijack
Some guy at http : // www . ilovenet . com . ar has published some of my blog posts without quoting me, without a link to my blog and without even mentioning my name. I don't know about the other blog posts, but at least two of them were written by me. I can find no contact on the blog and the comments require approval.
-
.NET Collections
Updated on October 17 2024
-
NHibernate Performance Optimization
Today Fabio Maulo (of NHibernate fame) posted on NHibernate performance optimization. Unfortunately, he didn't include the source code or the DB creation scripts, but I hope he will do it. The post is, however, very interesting, and it certainly shows that NHibernate performance can dramatically change if one knows what to do.
-
Using NHibernate Validator 1.0 with NHibernate 2.1
If you want to use NHibernate Validator with the latest version of NHibernate and you are tired of waiting for the new version of NHibernate Validator which works with NHibernate 2.1 and you also don't want to recompile the whole thing, here's what to do: you must tell the CLR to redirect requests for the old version of NHibernate and Iesi.Collections to the new versions. Add these lines to your App.config or Web.config, inside the <configuration> section:
-
.NET O/RM Performance Comparison
With the launch of the ORMBattle.NET site, a new discussion started on the blogosphere; later on, this post by Gergely Orosz added more ashes to the fire. The subject seems to be, is it possible to blindly compare O/RM tools, disregarding all differences between them, in simple yet not plausible scenarios, such as loading/saving/updating N entities in a loop?
-
NHibernate LINQ 1.0 Released
After the recent release of NHibernate 2.1.0 (a nice one!), the next best news is the release of LINQ to NHibernate!
-
NHibernate 2.1.0 Released
Great news!
-
Microsoft Anti-XSS 3.0 Library Released
Get it from here.
-
NHibernate Relations - One to One
This is my first post on NHibernate relations. I will first talk about a somewhat misused relation, one to one.
-
NHibernate in Action Book
-
NHibernate and Manually Assigned Identifiers
Be careful when you use manually assigned identifiers on your entities, because NHibernate looks at them to determine if an object is new or is already in the database.
-
NHibernate Mappings
In this post, I will talk about NHibernate mappings. Let's start from the data model:
-
Sharing Resources between a Web and a Windows Forms Application
It is possible to share a common set of resource files between a web and a windows forms application quite easily. You first create the resource files on the web application as global resource files, and place them on the App_GlobalResources folder. On the windows application, add a link to these files, that is, do not copy them. Make sure you mark them as embedded resources. Here comes the tricky part: you can see from the generated classes that these classes are trying to load from the App_GlobalResources folder, what you have to do is, through reflection, change the resource manager to point to the current assembly and resource location. Let's see how this is done: FieldInfo fi = typeof(MyResourceClass).GetField("resourceMan", BindingFlags.Static | BindingFlags.NonPublic); fi.SetValue(null, new ResourceManager("My.Full.Default.Assembly.Namespace.MyResourceClass", Assembly.GetExecutingAssembly()); In this example, suppose your windows forms assembly has a default namespace of My.Full.Default.Assembly.Namespace. And that's it! You can now do: String myVariable = MyResourceClass.MyResource on both projects.
-
FormsAuthentication and Session Timeouts
Because the FormsAuthentication and the Session cookies are not the same, it is possible that when you are accessing your application you are still logged in, but the session has expired. In this situation, perhaps the best thing to do is logout from FormsAuthentication and redirect to the same page. You can do this through a custom module. Let's see how:
-
Off Proc Session State and Custom Classes
If you want to store a custom class in an off-proc session (SQL Server, ASP.NET State Service, custom) that serializes objects, you must be aware that if the base class for your custom class implements, directly or indirectly, System.Runtime.Serialization.ISerializable, you must add a public or protected constructor to your class that has the following signature:
-
Enterprise Library Contrib 3.1 Released
Version 3.1, fully compatible with Enterprise Library 4.1 and .NET 3.5, was released. You can get it from http://www.codeplex.com/entlibcontrib.
-
Circular References in WCF
Updated: thanks to Nobody for the remark!
-
ASP.NET Bundle
Unit Testing ASP.NET? ASP.NET unit testing has never been this easy.
Typemock is launching a new product for ASP.NET developers – the ASP.NET Bundle - and for the launch will be giving out FREE licenses to bloggers and their readers.
The ASP.NET Bundle is the ultimate ASP.NET unit testing solution, and offers both Typemock Isolator, a unit test tool and Ivonna, the Isolator add-on for ASP.NET unit testing, for a bargain price.
Typemock Isolator is a leading .NET unit testing tool (C# and VB.NET) for many ‘hard to test’ technologies such as SharePoint, ASP.NET, MVC, WCF, WPF, Silverlight and more. Note that for unit testing Silverlight there is an open source Isolator add-on called SilverUnit.
The first 60 bloggers who will blog this text in their blog and tell us about it, will get a Free Isolator ASP.NET Bundle license (Typemock Isolator + Ivonna). If you post this in an ASP.NET dedicated blog, you'll get a license automatically (even if more than 60 submit) during the first week of this announcement.
Also 8 bloggers will get an additional 2 licenses (each) to give away to their readers / friends.
Go ahead, click the following link for more information on how to get your free license. -
NHibernate Property Validator for ASP.NET
Suppose you want to validate an ASP.NET control based on some validation attributes from a property. You may know that the Enterprise Library Application Block's PropertyProxyValidator does just this, the problem is that it uses Enterprise Library's own validation attributes. If you want to use NHibernate Validator's, your on your own.
-
ODP.NET Associative Arrays
Through ODP.NET you can use Oracle's Associative Array feature. Unfortunately, there is a limitation: you cannot have associative arrays with an index type other that number.
-
Using MTOM with WCF
Suppose you want to transmit large binary contents (a file, for example) through WCF. In the usual way, you would use a classe decorated with a [DataContract] attribute, and you would have inside of it a property of type Byte[], marked with a [DataMember], where the actual contents would be placed. There is a problem with this solution, however: being SOAP based exclusively in text (it is just XML), if you want to send special characters inside of it, you must convert them into text, using common encoding techniques such as Basw 64. Now, WCF does this for you, you just have to supply the byte array, and it does all the work, the problem is that Base 64 typically increases the total size by 33%.
-
New Version of AJAX Control Toolkit Released
Release 30512. Get it from http://www.codeplex.com/AjaxControlToolkit.
-
SQL Server 2008 Developer Training Kit Released
Get it here: http://www.microsoft.com/downloads/details.aspx?FamilyID=E9C68E1B-1E0E-4299-B498-6AB3CA72A6D7&displaylang=en.
-
WSS 3.0 and MOSS 2007 SP2 Released
Read about it and download it from http://blogs.msdn.com/sharepoint/archive/2009/04/28/announcing-service-pack-2-for-office-sharepoint-server-2007-and-windows-sharepoint-services-3-0.aspx.
-
Programming Entity Framework Book
-
Using TransactionScope with ODP.NET
If you are using Oracle Database Provider for .NET (ODP.NET) and you want to use TransactionScope'd transactions, you may have gotten the dreaded "Data provider internal error(-3000) [System.String]" exception. I'll explain how I fixed it.
-
ASP.NET MVC Training Kit Released
Get it here.
-
Enterprise Library 4.1 and Unity 1.2 Hands-on Labs Download - Patterns & Practices
Good news: the long-promised Hands-on Labs for Unity has been released!
-
Changing Thread-Safety Dynamically
Sometimes there may be a need to decide dynamically (through code in your program) whether a class is thread-safe or not. This is the technique I use:
-
ASP.NET MVC 1.0 Released
Get it from http://www.codeplex.com/aspnet, including source code and a sample project.
-
Interface Inheritance
I am normally against having an interface inherit from another one, but there's a situation where I am in favor of it: web service interfaces!
-
Enterprise Library 5 Wish List
Updated!
-
Setting Custom Identity in WCF
WCF was designed to be fully extensible, at all levels. If I want to pass a custom identity (an application-defined username and role and the desired culture) to a WCF web service (not using ASP.NET compatibility mode), this is what I do:
-
Catch All Exceptions
As you may know, an exception is always thrown in the context of a running thread; what happens if there is no try...catch block protecting that thread? The exception is propagated to the application domain level, where, eventually, it will cause your application to crash.
-
ASP.NET Validation with the Enterprise Library Validation Block
The Enterprise Library comes with a custom ASP.NET validator, that gets validation from the metadata defined in your classes. If you have seen my previous post, you know how to add validation metadata to a POCO, usually a data transfer object. Basically, you either 1) add attributes to public properties and fields or 2) configure XML files. I'll stick to the first approach. What I'll show you next is how to do validation on web forms based on the validation metadata from a class. First, add a reference to the Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet assembly, and enter the following markup on you ASPX page:
-
Validation of WCF Requests with the Enterprise Library Validation Block
In order to enable validation of the properties of a request message, you only need to add a [ValidationBehavior] attribute to your service interface, just next (or before) the [ServiceContract], and a [FaultContract(typeof(ValidationFault))] on the method declaration. The ValidationBehaviorAttribute and ValidationFault classes are defined in the Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF assembly and are part of the Validation Application Block of the Enterprise Library 4.1, more specifically, of the WCF integration module.
-
New Cumulative Update for SharePoint Released
A new cumulative update for SharePoint (actually one for WSS and another one for MOSS) has been released.
-
ASP.NET Page Events Lifecycle
When using master pages, the normal page event lifecycle is a little different. Here is the actual order:
-
Enterprise Library Lifetime Managers
Update: fixed a bug in the attached code.
-
Dependency Injection on an ASP.NET Page
In order to have dependency injection on your ASP.NET pages, the best way to go is through a customized page handler factory. A page handler factory is a class directly or indirectly derived from PageHandlerFactory who has the responsibility to create a new instance of a Page. What we do is, we call the base class implementation of GetHandler method and then we call IUnityContainer's BuildUp method. Of course, we must also
-
Enterprise Library Call Handlers
Call Handlers are Enterprise Library's extension mechanism. They allow code to be injected before or after a method is called. Enterprise Library, as of version 4.1, comes with the following call handlers and associated handler attributes, in assembly Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers:
-
Calling Web Service Methods Synchronously in ASP.NET AJAX
Update: I had forgot to send the code for the synchronous executor. Here it is, as an attachment.
-
No-Compile Web User Controls
When using no-compile web user controls (where the CompilationMode directive is set to Never), you cannot just add them to your web page declaratively.
-
Useful Expression Builders
Expression builders are a cool subject... they work with no-compile pages and provide a lot of declarative power!