Archives
-
SharePoint References
I just updated my Excel I mentioned before with lots of hopefully useful SharePoint references:
-
The SPDataSource Control
SPDataSource, together with XsltListViewWebPart, DataFormWebPart and ContentByQueryWebPart, is one of the most powerful tools that SharePoint provides. Because it can be used in different ways, it can also get complicated. In this post I am going to talk about is different modes and what can they give us. Fist, you need to know that the mode comes from the DataSourceMode property and can be one of:
-
Entity Framework Pitfalls: Collections of Types Other Than ICollection<T> Are Ignored
If you expose in your entity a collection of a type other than ICollection<T> (or one inheriting from it, such as IList<T>) then it will be ignored. This is a bit absurd, because you might want to expose a collection as read only, where you would probably use IEnumerable<T>. For the record, NHibernate allows that.
-
Lesser-Known NHibernate Features
Updated on October 5th.
-
NHibernate Pitfalls: HQL Queries With Joins
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
Lesser-Known NHibernate Features: Proxy Generation
Did you know that you can leverage NHibernate’s built-in proxy generator to inject custom behavior in your classes? It is called NHibernate.Proxy.DynamicProxy.ProxyFactory and there’s an interface, NHibernate.Proxy.DynamicProxy.IInterceptor, that you can use to extend it, by intercepting method and property calls.
-
Lesser-Known NHibernate Features: Serializable Values
If you want to store anything in a property of an entity, you can declare it as Object or dynamic; as long as you set it to a value of a serializable type, as supported by BinaryFormatter, you’re good! You can even change the value afterwards to a different type, and it will be saved.
-
Speech Recognition in ASP.NET
Speech synthesis and recognition were both introduced in .NET 3.0. They both live in System.Speech.dll. In the past, I already talked about speech synthesis in the context of ASP.NET Web Form applications, this time, I’m going to talk about speech recognition.
-
Loading ASP.NET MVC Controllers and Views From an Assembly
Back to MVC land! This time, I wanted to be able to load controllers and views from an assembly other than my application. I know about the extensibility mechanisms that ASP.NET and MVC give provides, such as Virtual Path Providers and Controller Factories, so I thought I could use them.
-
ASP.NET NHibernateDataSource
A long, long time ago, I wrote a NHibernateDataSource control. Back then, it was based in the first LINQ provider for NHibernate, and a long has happened since. Now, I decided to give it another go!
-
Entity Framework Pitfalls: Registering Custom Database Functions for LINQ
Like I said in my previous post, it’s not enough to add a DbFunctionAttribute attribute to a method to have it call a database function. If the function is not a built-in one, it will not be registered in the Entity Framework provider manifest for SQL Server, so it will require registration in the model. You might think, just by looking at the methods in SqlFunctions that all that it took was to add this attribute, but you would be wrong.
-
Registering SQL Server Built-in Functions to Entity Framework Code First
It is possible to register custom functions that exist in the database so that they can be called by Entity Framework Code First LINQ queries.
-
Getting the Current User in SharePoint XSLT
SharePoint offers a couple of ways by which we can obtain the current user for use in a XSLT web part like DataFormWebPart or XsltListViewWebPart. All involve first setting parameters through the ParameterBindings property:
-
Book Reviews
This page will list all of my official (books for which I was the, or one of the, tech reviewers) and unofficial book reviews, in no particular order.
-
Show All Content in XSLT
I have already shown how you can display all attributes and their values from a XSLT content, but in case you want to look at the whole structure plus their attributes, you can use this instead:
-
Access Navigation Nodes in SharePoint XSLT
SharePoint relies on ASP.NET Site Map Providers for generating navigation links on its default pages. Specifically, the default Web.config file registers a (big!) number of providers, which control different aspects of its navigation:
-
ASP.NET Web Forms Extensibility: Output Encoders
Since version 4, ASP.NET offers an extensible mechanism for encoding the output. This is the content that will be returned to the browser. I already refered it in Providers.
-
Getting the SQL from a LINQ Query in NHibernate
In case you ever want to have a look at the generated SQL before it is actually executed, you can use this extension method:
-
Windows Azure Websites Succinctly
Another book for which I was a technical reviewer in the Succinctly series just got released: Windows Azure Websites Succinctly. The author is Kyle Burns (@kyleburnsdev), who keeps a blog on development at http://geekswithblogs.net/kyleburns.
-
Retrieving SharePoint User Profile Properties in XSLT
A common request is to be able to retrieve user information from XSLT (XsltListViewWebPart, DataFormWebPart, etc). It is possible to obtain some information through server variables (LOGON_USER), CAML variables (UserID) or ddwrt:UserLookup extension function. It works, to some extent, but sometimes it is not enough.
-
NHibernate Pitfalls: Refreshing Manually Created Entities Does Not Bring Lazy Properties of Base Types
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
-
Distinct Values in XSLT
How to get distinct attribute values:
-
NHibernate Goodies Coming Soon
Just for you to know that the NHibernate community hasn’t been sleeping, here’s a list of some of the cool new features that are on the queue for the next NHibernate versions.
-
XSLT For Loop
If you ever need to implement a for loop in XSLT, here’s one possibility:
-
Exposing SharePoint Context to XSLT
Picking on my previous post, I am going to show how you can access SharePoint (and ASP.NET context) from XSLT.
-
Editing a Post in Weblogs.asp.net
Updated
-
Displaying All Fields in a SharePoint Data Source
So, you want to know which fields your data source is returning. You can use the following XSLT:
-
Injecting Content in an ASP.NET Web Forms Page From a Module
Modules are a great extensibility mechanism because they allow us to glimpse into a request and to do something before the response is sent back.
-
Custom XSLT Functions in SharePoint
Wouldn’t it be good if SharePoint would allow the registration of custom functions that could be used in XSLT stylesheets? Well, as it happens, it does!
-
A Tour of SharePoint Data Source Controls
Besides the classic ASP.NET data source controls, SharePoint brings along its own. These allow us to retrieve data not just from SharePoint, but also from external sources, such as web services or SQL databases. Using SharePoint Designer you end up using these data sources without even knowing, and, specially, ignoring what other options you have. Let’s look at these controls one by one and see how the can be used. I already talked about the SPDataSource and AggregateDataSource, so I won’t cover these here. I also won’t be covering them in depth, but instead will provide an example of how to use them.
-
SharePoint Field Reference
I know there are dozens out there, but I decided to publish my own field reference for SharePoint. Besides the usual attributes, I include some others, like the SharePoint and CLR type, the enumeration where it is declared (if any), the control used to render it and some more.
-
Aggregating Lists in SharePoint
Another post that could be subtitled “How to do Things in SharePoint By Hand”. This time, combining data sources – lists, in this case, but the same can be applied to other source types, such as SOAP (SoapDataSource) or REST (XmlUrlDataSource) web services, hierarchies of sites (SPHierarchyDataSourceControl), calendar (SPCalendarDataSource), XML files (SPXmlDataSource), BCS external lists (BdcDataSource) or even SQL queries (SPSqlDataSource).
-
Displaying Last Modified Contents in SharePoint
SharePoint, as usual, offers lots of ways to do things. This time, I’m going to show how one can get a list of the last modified contents, in any SharePoint version and edition.
-
Entity Framework Pitfalls: Batch Modifications
Entity Framework does not support batch modifications, that is, UPDATEs or DELETEs of several entities at once. Neither classic nor Code First, not even Entity-SQL.
-
Unity - Part 8: Web
Long overdue in the Unity series, how to use Unity in a web application. You can find the other posts here (Adding Interfaces), here (Registration by Convention), here (Injecting Values), here (Extensions), here (Aspect-Oriented Programming), here (Dependency Injection) and here (Introduction).
-
Displaying Current Weather Status in SharePoint
OpenWeatherMap.org offers a nice service for obtaining current and forecast weather conditions. Go visit it, and search for the “weather in your city”. In the results page, by hovering the link, you will get the id for the city you are interested in; for example, for “Coimbra, Portugal”, it is 2740637 (http://openweathermap.org/city/2740637).
-
TextBox With Suggestions in SharePoint
This control will suggest values for a text box from the values in a SharePoint list. It makes use of the HTML5 datalist element in a slightly customized TextBox control.
-
Adding Markup to a SharePoint Page
How many times have you had the need to add ASP.NET markup – HTML and server-side control declarations – in a SharePoint page? Yes, there is the Script Editor Web Part and the Content Editor Web Part, but none of these allow you to enter server-side control declarations, just plain HTML, CSS and JavaScript.