.net-3.5

Keeping a "reference" to a row object for a long time

In my application I keep a LINQ object fetched from the database, and regularly modifies it followed by db.SubmitChanges(). I have read that you are not supposed to keep around the DataContext object for a long time. But if I close my DataContext between modifications, I guess the data object loses its link to the actual database row. ...

Binding DataList Containing Checkboxes to a Dictionary

Hi. I have a DataList like so: <asp:DataList ID="dlMyList" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" CellSpacing="5" > <ItemTemplate> <asp:CheckBox ID="cbMyBox" Runat="server" Text='<%# Container.DataItem%>' ToolTip=''></asp:CheckBox> </ItemTemplate> </asp:DataList> I'm binding this to a D...

Why call SqlClient.SqlDataReader Close() method anyway?

Is the SqlClient.SqlDataReader a .NET managed object or not? Why do we have to call the Close() method explicitly close an open connection? Shouldn't running out of scope for such an object automatically close this? Shouldn't garbage collector clean it up anyway? Please help me understand what is the best practise here. I have seen a r...

Design Question - Control Array

Ok, I know how to do this, but I want to know if this is the BEST way. I have a table called "Topics" which has a list of topics(obv). I have a page with about 20 (+/-10) check boxes with all the different topics a user can subscribe to. I figured the best way to do this is to make a control array of check boxes and populate it on page...

Fetching items which has a specific set of child elements (advanced query - possible?)

Hi, I have a SQL database (SQL Server 2008) which contains the following design ITEM ID (Int, Identity) Name (NVarChar(50)) Description (NVarChar(200)) META ID (Int, Identity) Name (NVarChar(50)) There exists a N-N relationship between these two, i.e an Item can contain zero or more meta references and a meta can be associated ...

What is the difference between IQueryable<T> and IEnumerable<T>?

What is the difference between IQueryable<T> and IEnumerable<T>? ...

Creating a derived control

I have an abstract base class which inherits from UserControl and which is then used to derive a number of classes. The problem I have is how to elegantly ensure that the generated function InitializeComponent() is called for each layer of class. So the (abstract) base class has a number of controls on it that will be shared for all ...

What's the fastest track to learning to build enterprise ASP.NET v3.5 apps?

Having not done ASP.NET since v1.1, and now blitzing through the Wrox Pro ASP.NET v3.5 book, what other resources are available to get me developing enterprise ASP.NET apps the fastest? I've been developing in DotNet since Beta and have been doing Winform & middle-layer architecture/design/dev for 3.5 years now (as this has been my clie...

Recursive control search with Linq

If I wanted to find checked check boxes on an ASP.NET page I could use the following Linq. var checkBoxes = this.Controls .OfType<CheckBox>() .TakeWhile<CheckBox>(cb => cb.Checked); That works fine if the checkboxes are nested in the current control collection, but I'd like to know how to exte...

How to work with objects using Dynamic WCF?

We currently have developed an application using WCF. Our clients make connections to different WCF servicehosts located on the server, and the servicehosts return the data from the DB that the clients need. Standard model. However, this current design has all of our WCF data in app.config files both on the client side as well as the ser...

WSE 2.0 SP2 on VS 2008

Is it possible to use WSE 2.0 SP2 under VS 2008? I realise that the add-in (that generates the proxy classes/configuration) is not compatible but there are work-arounds to this (copying over the files from a VS 2003 solution). Our web services are relatively static so would not be making too many changes anwyay. We may at a future date...

ASP.NET aspxerrorpath in URL

I have a site where I use CustomErrors in the web.config to specify a custom error page, and that's working just fine. The custom 404 page is also specified in the IIS configuration (because if it's not, I don't get my custom 404 page). But I have some logic that kicks in if a user gets a 404 that looks at their requested URL and make ...

How is the .net Entity Framework overkill versus LinqToSql?

I've heard it said that the Entity Framework is overkill or that it's difficult to learn compared to LinqToSql. I am wondering in what way? I used LinqToSql and like it. So, I am trying the EF and for the things I'm doing they seem almost exactly the same. Namespaces and method names are different but so far I don't see anything that...

How can i get rid of hard coding in creating a new EntityKey in Entity Framework

How can i get rid of hard coding in creating a new EntityKey in Entity Framework ...

Using ScriptCombining through a ScriptManager on a Master Page

ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on this video. However he only demonstrates how to use the feature with the ScriptManager on the same page. I'd like to use this feature on a site where the scriptmanager is on the master page but can't figure out how to add the scripts I...

.NET Runtime 2.0 Error in a service

We have a custom service that writes to a DB (SQL 2005). This is a full 64-bit environment (DB, .NET service). On one of our servers we crash every morning when we have a spike in our volume of data. On another server we run fine. The only differences that I've been able to notice between the two machines is that the one experiencing...

Get a generic method without using GetMethods

I want to get the method System.Linq.Queryable.OrderyBy(the IQueryable source, Expression> keySelector) mehthod, but I keep coming up with nulls. var type = typeof(T); var propertyInfo = type.GetProperty(group.PropertyName); var propertyType = propertyInfo.PropertyType; var sorterType = typeof(Func<,>).MakeGenericType(type, propertyTyp...

What are the benefits of using WCF?

We currently just utilize soap webservices for all our communication but have been thinking about moving to WCF instead. What are the benefits of using it over an asmx service? If we do go with a WCF service, can other languages still communicate with it? SOAP is standardized and all languages can interact with it. Are there any really ...

.Net 3.5 WebService can't be called by .Net 1.1 Windows App

I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer able to call it. Creating a little windows app in 3.5 as a t...

Why is LazyInit<T> restricted to reference types

I have a pseudo-realtime data processing application where I would like to use LazyInit<double> so I don't do calculations I don't need, but LazyInit<T> restricts T to classes. I can work around it, but I'd obviously prefer not to. Does anybody know why this is? ...