Browse by Tags

All Tags » LINQ (RSS)
If you have developed applications with LINQ to SQL, you know that one of the features of these objects are that they are aware of the DataContext they were created in. This can have issues in ASP.NET if you do not cache the DataContext it belonged to...
Posted by bmains | with no comments
Filed under:
To a point, LINQ to SQL works well with unit testing. When the LINQ-to-SQL objects are in a detached state (either not submitted to the database, or detached through the detach command) and there isn't a chance of accidentally updating records or...
Posted by bmains | with no comments
Filed under: ,
I don't know if anyone has come across this, but I ran into an interesting issue today. I had done this LINQ query in C#: from c in store.Customers where c.IsActive = true select c; What I was trying to accomplish is find all of the customers where...
Posted by bmains | with no comments
Filed under:
I had an issue using AsQueryable() in some of my code. What I was trying to do is this: CustomerDAL customers = new CustomerDAL(this.DataContext); short key1 = customers.GetPrimaryContact(selectedCustomer).CustomerKey; short key2 = customers.GetSecondaryContact...
Posted by bmains | with no comments
Filed under:
I found this a while ago about using dynamic LINQ in your code. This really works well with the ASP.NET GridView (and other data bound controls) where sorting is supported. Because, when a column header is clicked, the Sorting event fires with the details...
Posted by bmains | 2 comment(s)
Filed under:
LINQ to SQL is an intricate, yet "sensitive" tool into how it works. A LINQ to SQL query is translated into a SQL query that is performed against the database. This process occurs through a series of components that break the expression down...
Posted by bmains | with no comments
Filed under:
One of the problems you may experience is the issue of postbacks with the "staleness" of queried data. Because ASP.NET is stateless, when after unloading resources, all previously known resources are gone. A common way to keep data around is...
Posted by bmains | with no comments
Filed under: ,
I've mentioned before (probably several times) about using LINQ business object references instead of key (or other) values in your BAL or DAL code. Though I have mentioned it before, I decided to come up with a few scenarios. The first scenario is...
Posted by bmains | with no comments
Filed under:
If you are familiar with LINQ, you know that your objects have hierarchies, that can be a challenge when binding to ASP.NET tabular controls such as the GridView. So how can you do this? Anonymous types can come to the rescue. For instance, if you want...
Posted by bmains | with no comments
Filed under: ,
LINQ to SQL maintains object relationships between all tables, mimicing how the database looks. What I mean by that is that you can drill down (or up) through a database hierarchy in an object-oriented fashion, simply by referencing the property. So an...
Posted by bmains | with no comments
Filed under:
After doing some forum posting around, I found this tool: http://www.linqpad.net/ . It seems to be pretty functional; I've messed around with it some, and it's going to help greatly in testing my LINQ queries. Although there isn't any intellisense...
Posted by bmains | 1 comment(s)
Filed under:
LINQ maintains references to all of its relationships. For instance, any PK or FK relationships are maintained as an object reference, so you can drill down into the PK or FK object or collection. However, whenever you insert a new record, this reference...
Posted by bmains | 1 comment(s)
Filed under:
I've been asked about the different contexts that data can be queried, which there is some. With LINQ to SQL, when querying against the data context, there is limited support for what can be done with LINQ to SQL; this is because the parser evaluates...
Posted by bmains | 1 comment(s)
Filed under:
When using LINQ, not everything works as you may expect. Your custom methods in your code, for instance, do not work at all in a LINQ query. When the LINQ expressions are built, objects in LINQ have to map over to a valid C# or VB.NET operator so that...
Posted by bmains | with no comments
Filed under:
One of the bigger challenges comes from errors that occur due to inserts, updates, or deletes to the database. This can be not so much from the LINQ side as an issue, but from the database side. For instance, with LINQ to SQL, a LINQ object has a string...
Posted by bmains | with no comments
Filed under:
More Posts Next page »
The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.