Archives
-
ASP.NET Web Forms Extensibility: Expression Builders
I have talked extensively about expression builders in the past, and that is because I find them extremely useful, for building no code solutions.
-
Windows Presentation Foundation 4.5 Cookbook Review
-
Loading Entities Dynamically with Entity Framework
Sometimes we may be faced with the need to load entities dynamically, that is, knowing their Type and the value(s) for the property(ies) representing the primary key.
-
Win a Free Copy of Windows Presentation Foundation 4.5 Cookbook
Win A free copy of the 'Windows Presentation Foundation 4.5 Cookbook', just by commenting!
-
Adding Suggestions to the SharePoint 2010 Search Programatically
There are numerous pages that show how to do this with PowerShell, but I found none on how to do it with plain old C#, so here it goes!
-
Wrapping ASP.NET Client Callbacks
Client Callbacks are probably the less known (and I dare say, less loved) of all the AJAX options in ASP.NET, which also include the UpdatePanel, Page Methods and Web Services. The reason for that, I believe, is it’s relative complexity:
-
More SharePoint 2010 Expression Builders
Following my last post, I decided to publish the whole set of expression builders that I use with SharePoint. For all who don’t know about expression builders, they allow us to employ a declarative approach, so that we don’t have to write code for “gluing” things together, like getting a value from the query string, the page’s underlying SPListItem or the current SPContext and assigning it to a control’s property.
-
General Purpose ASP.NET Data Source Control
OK, you already know about the ObjectDataSource control, so what’s wrong with it? Well, for once, it doesn’t pass any context to the SelectMethod, you only get the parameters supplied on the SelectParameters plus the desired ordering, starting page and maximum number of rows to display. Also, you must have two separate methods, one for actually retrieving the data, and the other for getting the total number of records (SelectCountMethod). Finally, you don’t get a chance to alter the supplied data before you bind it to the target control.
-
SharePoint 2010 Field Expression Builder
OK, back to two of my favorite topics, expression builders and SharePoint. This time I wanted to be able to retrieve a field value from the current page declaratively on the markup so that I can assign it to some control’s property, without the need for writing code. Of course, the most straight way to do it is through an expression builder.
-
Fixing SharePoint 2010 Permission Problems on Windows 7
I had a tough time trying to have SharePoint working perfectly on a Windows 7 development machine that was occasionally disconnected from the Active Directory (when I am home I must connect through a VPN). I mostly had problems with service applications such as User Profile, Managed Metadata, Business Connectivity Services and the like, and all I knew were cryptical messages such as “access denied” or “the service or application pool is not started”. I was sure that both the services and application pools were running under a domain account that had proper permissions on the SQL Server instance, and basically it was a fresh installation. Lots of people are having the same problem, apparently. After banging my head against the wall for several days, I remembered about farm (what I had) versus stand-alone (which I had never tried) installations. Bingo!
-
ASP.NET Web Forms Extensibility: Control Adapters
All ASP.NET controls from version 2.0 can be associated with a control adapter. A control adapter is a class that inherits from ControlAdapter and it has the chance to interact with the control(s) it is targeting so as to change some of its properties or alter its output. I talked about control adapters before and they really a cool feature.
-
NHibernate Pitfalls: Custom Types and Detecting Changes
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
ASP.NET Web Forms Extensibility: Handler Factories
An handler factory is the class that implements IHttpHandlerFactory and is responsible for instantiating an handler (IHttpHandler) that will process the current request. This is true for all kinds of web requests, whether they are for ASPX pages, ASMX/SVC web services, ASHX/AXD handlers, or any other kind of file. Also used for restricting access for certain file types, such as Config, Csproj, etc.
-
ASP.NET Web Forms Extensibility: Providers
Updated on August 28th to add the Virtual Path provider. Thanks, Matthew Schaad!
-
NHibernate Pitfalls: QueryOver and Deep Expressions
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
What Makes SharePoint SharePoint
SharePoint is ASP.NET, it is well known. Yet, sometimes, it may be difficult to understand why/how some features work, because we don’t usually see them in regular ASP.NET development. However, all of them are build upon standard ASP.NET/IIS functionality, which you can easily duplicate on non-SharePoint environments. Here are some clues.
-
Restricting Access to Properties in NHibernate
Update: unlike what I always thought, "protected internal" means "protected" OR "internal", so this technique is really not that necessary. Thanks to all the commenters who brought that to my attention!
-
NHibernate Pitfalls: Inheritance and Proxies
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
Strongly Typed Delete With NHibernate
To my great satisfaction, LINQ is nowadays present everywhere, from XML processing, to database querying, including SharePoint. The “Q” in it standing for Query, it’s not a surprise that is mainly being used for querying, but it would be interesting to use it for other scenarios, such as updating and deleting.
-
NHibernate Pitfalls: Querying Unmapped Properties With LINQ
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
Using the ASP.NET Health Monitoring Provider to Secure Your Application in the Case of an Attack
The ASP.NET Health Monitoring is a featured introduced in ASP.NET 2.0. Basically, you have your application raise web events – not to be confused with user interface events – and you configure rules that define, for a given event code or range of event codes, a time interval and a minimum and maximum number of occurrences, the health monitoring provider that the events will be routed to. The ASP.NET infrastructure already raises a number of these events, and you can also define your own events, and take the responsibility to raise them when appropriate. I won’t go into describing how the health monitoring works, there are several web sites that describe it, instead, I will talk about a different use.
-
NHibernate Pitfalls: Eager Loading Multiple Collections
Updated on July 19. Thanks, Hazzik!
-
Using ASP.NET Resources in JavaScript
If you use resources in your web application to localize your strings on the server side, you may have also felt the need to use the same resources in JavaScript. The thing is, there wasn’t any straightforward way to do it. Until now, that is!
-
NHibernate Pitfalls: Cascades
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
NHibernate Pitfalls: Lazy Scalar Properties Must Be Auto
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
Vote of Disconfidence to Entity Framework
A friend of mine has found the following problem with Entity Framework 4:
-
Implementing an Interceptor Using NHibernate’s Built In Dynamic Proxy Generator
Updated: important correction, reported by Christoph; when the event is raised, the first argument should be info.Target, not this.Proxy. Thanks!
-
NDepend 4 – First Steps
Thanks to Patrick Smacchia I had the chance to test NDepend 4. I can only say: awesome!
-
Differences Between NHibernate and Entity Framework
Note: this post is outdated, read this for updated info on Entity Framework Core 8
-
ASP.NET MVC Validation Complete
OK, so let’s talk about validation. Most people are probably familiar with the out of the box validation attributes that MVC knows about, from the System.ComponentModel.DataAnnotations namespace, such as EnumDataTypeAttribute, RequiredAttribute, StringLengthAttribute, RangeAttribute, RegularExpressionAttribute and CompareAttribute from the System.Web.Mvc namespace. All of these validators inherit from ValidationAttribute and perform server as well as client-side validation. In order to use them, you must include the JavaScript files MicrosoftMvcValidation.js, jquery.validate.js or jquery.validate.unobtrusive.js, depending on whether you want to use Microsoft’s own library or jQuery. No significant difference exists, but jQuery is more extensible.
-
ASP.NET MVC CRUD Validation
One thing I didn’t refer on my previous post on ASP.NET MVC CRUD with AJAX was how to retrieve model validation information into the client.
-
Yet Another ASP.NET MVC CRUD Tutorial
I know that I have not posted much on MVC, mostly because I don’t use it on my daily life, but since I find it so interesting, and since it is gaining such popularity, I will be talking about it much more. This time, it’s about the most basic of scenarios: CRUD.
-
Site Map Provider Integrated Authorization
The ASP.NET out of the box included site map provider, XmlSiteMapProvider, allows specifying one or more required roles for each node it knows about. Let’s say you have something like this on your Web.sitemap file:
-
URL Related Expression Builders
Well, it has been quite a while since I talked about expression builders. If you haven’t already, I suggest you have a look at that, I think you will find interesting stuff there. Because I think this is an important topic for ASP.NET, I have two new expression builders for you:
-
Saving View State in Cache
Most people who have worked with ASP.NET web forms know about view state; they may have both benefited from and cursed it, since it allows simple things to be done very easily but also as easily doing very stupid things, like filling up an HTML page with several megabytes of data which have to be submitted on each postback.
-
O/RMs Dissected: My first article for Software Developer's Journal
My first article for Software Developer’s Journal came out on the SDJ Extra issue. You can download it from http://en.sdjournal.org/new-sdj-extra-0212-4/. I talk about what an O/RM is and why it is useful. Here’s the introduction:
-
SharePoint 2010 Leiria
Ontem ocorreu o primeiro evento SharePoint 2010 Leiria, organizado pelo David Frazão, que me convidou, e no qual tive a honra de participar. Estavam presentes cerca de 12 pessoas, com experiências muito variadas de utilização do SharePoint. Foi muito interessante, sobretudo, se se vier a repetir!
-
Entity Framework Code First: Get Entities From Local Cache or the Database
Entity Framework Code First makes it very easy to access local (first level) cache: you just access the DbSet<T>.Local property. This way, no query is sent to the database, only performed in already loaded entities.
-
Creating a Control From its Markup Representation
No words, just code!
-
General Purpose Data Annotations Validation Attribute
The Data Annotations framework, introduced in .NET 3.5, and enhanced in .NET 4.0, is likely becoming the basis for attribute-based validation in .NET. I like about it the fact that it is extensible and that it can be (and indeed it is) used in a lot of scenarios, from Silverlight to ASP.NET MVC and Dynamic Data.
-
Evento Introdução ao SharePoint 2010
No dia 25 de Fevereiro vai ter lugar em Leiria mais um evento organizado pelo Grupo de Utilizadores do SharePoint 2010 de Leiria, com o apoio da Galileu.
-
Changing a Control’s Output Dynamically
A question that pops up occasionally in ASP.NET forums or sites like Stack Overflow is how to change a control’s output dynamically. Well, since the CSS Friendly Control Adapters came out, I knew how to do it statically, through static registration on a .browser file (it can also be done dynamically, for all controls of a certain type, by adding a fully qualified type name to HttpContext.Current.Request.Browsers.Adapters collection), but I decided to go and try to do it dynamically, without registration. More specifically, I wanted to achieve two things:
-
NHibernate Metadata
I know that O/RMs like NHibernate are supposed to shield us from the gory database internals such as tables, views, columns and such; however, at times, I do have the need to know how my domain model translates to the database. NHibernate, of course, provides us with the information we need, but it isn’t always easy to find, so I wrote my own extension methods for ISessionFactory that allow me to get the metadata I need in an easy way:
-
Remove View State from UpdatePanel Call
You may not be aware that view state (and control state) is included on each UpdatePanel call, even if the controls placed inside it have it disabled. As view state can get quite large, it may be useful to disable posting it during UpdatePanel calls, as long as you know what you are doing!
-
Twitter
Follow me at https://twitter.com/#!/RJPeres75
-
Detecting Authentication Expiration in ASP.NET
I recently had to solve a problem: when issuing an asynchronous call by using an UpdatePanel, if the user is no longer authenticated – due possibly to long inactivity – this situation is silently ignored. What happens is, when an unauthenticated user tries to access a protected resource, ASP.NET redirects the request to the login page, and still returns a 302 HTTP status code (Found).
-
Querying an Uninitialized Collection with NHibernate
I have talked before about the problem of accessing an uninitialized collection and presented a solution that allows us to see if the collection contains elements on the DB, and how many there are, without actually loading them. Now I have a general purpose solution for querying the collection on the DB.
-
NHibernate Pitfalls: SQL Queries and Parameter Prefix
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.