.net

WinForms - Does the Form.DoubleBuffered property influence controls placed on that form?

Form has the DoubleBuffered property (bool, inherited from Control). If this is set to true, are all controls placed on the form drawn to screen in a double buffered fashion by virtue of being on the Form? Or do you need to worry about their own DoubleBuffered properties? ...

Disabling HttpModule on certain location

I know that this has already been asked here but the answer (using a handler instead) doesn't solve the issue, as I'm using a third party component that doesn't implement IHttpHandler. So, again, is there any way to load/unload a HttpModule on a certain request? EDIT: I forgot to mention that we're working with .NET 2.0. I'm sorry abo...

Does Stream.Dispose always call Stream.Close (and Stream.Flush)

If I have the following situation: StreamWriter MySW = null; try { Stream MyStream = new FileStream("asdf.txt"); MySW = new StreamWriter(MyStream); MySW.Write("blah"); } finally { if (MySW != null) { MySW.Flush(); MySW.Close(); MySW.Dispose(); } } Can I just call MySW.Dispose() and skip the Close ev...

.tlh generated on 2 machines is different

I have a .NET dll which has some interfaces\classes which are exposed to com. during the build procedure a .tlb file is generated and this tlb is referenced by some c++ code. As a result the compiler generates a .tlh file for the tlb. When I run the build locally one of the properties in one of the interfaces ends up with a correspond...

How to use TextRenderer.DrawText to get ellipsis at the start

The TextRenderer.DrawText method has a TextFormatFlags parameter. Using TextFormatFlags.EndEllipsis allows you to abbreviate the text with an ellipsis at the end so that it fits in the available space. However, I want to put the ellipsis at the start. Curiously enough there is no TextFormatFlags value to do this. I've considered progre...

Built-in types, when (not) to use?

C# and VB.NET comes with built in types that maps to the CLR types. Examples are: int (C#) and Integer (VB) maps to System.Int32, long (C#) and Long (VB) maps to System.Int64. What are the best practices for deciding when to use built in types or not to use them (using the System.* structs/classes instead)? ...

Develop Locally on SQL Server 2005 then Deploying to Shared Hosting

What is the best way to develop on SQL Server 2005 machine locally while you get your database design and application design smoothed out and then deploy to a shared host? In the MySQL / phpMyAdmin world you have an option to export the table as the DDL Statement with the data represented as a bunch of inserts following the DDL. Using t...

Using SSL with a .net remote endpoint without IIS

I have setup a vanilla .net remote endpoint. It is behind a load balancer that handles SSL traffic so all the server side endpoint sees is plain old TCP traffic. The client configuration needs to be set up to connect to the load balancer over SSL. The whole point of this exercise is to remove IIS from the technology stack. What shoul...

Where can I find a good .NET PDF library?

We're webifying a winforms app with a mix of active reports and crystal reports. All will somehow be converted to PDF. There are so many tools out there. Anyone have experience with/recommendations for tools that we can use? SQL Reports are one possibility, but I'd like to explore other options instead of just taking what initially seem...

Why are sealed types faster?

Duplicate: Why seal a class? I am wondering about the deeper details about why this is true. ...

Scalar function in LinqToSql

In ADO.Net/SQLClient I would often do something like this: SELECT COUNT(*) FROM SomeTable WHERE SomeKey = 1234 ...and fire it using executescalar to return the value of count - for a simple check if something exists. How would I do the same using LinqToSql? ...

.NET Webservice half works, half 404's

I have a .NET webservice running as a windows service on a Windows Server2003 R2 computer. I have a separate .NET/C# 2.0 app running that calls this webservice from elsewhere on our LAN. The webservice has 2 methods - 1 of these method calls works flawlessly. However, the other method always returns a 404 "not found" error. I can vis...

No line numbers on exceptions from assembly generated by CompileAssemblyFromSource

My application has a scripting feature where I compile an in-memory assembly from the user's script using CodeDomProvider.CompileAssemblyFromSource. It's similar to what's described in this answer. It works very well, but any exceptions that get thrown from the script code don't have line numbers in the stack trace. I tried setting the ...

.net datapager + listview + Intelligencia.UrlRewriter

Hi, i am using Intelligencia.UrlRewriter on a page that has a listview control and datapager. Data paging works fine but pager uses real url instead of rewritten one. if url rewrite is /products-page-1.aspx?page=2 and real url /products.aspx?id=1 pager uses /products.aspx?id=1&page=2 i want to be able to set it so pager uses /produc...

Are subqueries in LinqToSql guaranteed to be in the same order as their parent?

lets say i have a table with a DateTime field and a int field and perform a query like this: var query = context.tblSomeTable.Where(s=>s.Name == "Hello World").OrderBy(s=>s.SignUpDate); if I then perform two subqueries with the result, are they still ordered by the date?: var sub1 = query.Where(s=>s.Id = 5); var sub2 = query.Where(s=...

Linq and DB relationships

quick question here guys. I'm working with an older database, which had no relationships adn am now trying to make it as consistent as possible. the code that I'm porting had some quirks which led to some situations where I cannot enforce the relationship (PK <-> FK). I was wondering if this enforced relationship is a requirement for L...

LINQ Entities as business objects - pro/cons

Hello all, the dbml file generated by Visual Studio (sqlmetal) comes with entities mapped to database tables. In your opinion, these clases are suitable to be used as domain model classes? Or should we avoid them and isolate them into the data access layer only? Thanks ...

How to save picture in the database?

Hi , i'm working on Linq To Sql,WPF and i have a database now i need to save some picture in the database but i don't know which is the correct datatype to save the pictures Database(this database would be connect from 10 users in the same time). Can you point me in the right way to overcome this step? If i didn't wrong it is not a good...

JUnit Max Equivalent Tool for Visual Studio

I have been trying to find a tool similar to JUnit Max for Visual Studio. Preferably, the tool would work with Visual Studio 2008 Professional and NUnit. For those who are apparently unable to click through to the JUnit Max site, here is the description. JUnit Max is a continuous testing plug-in for Eclipse that helps programmers s...

Caching Strategies with Paged/Filtered Data

Hi, I am currently thinking about Caching Strategies and more importantly avoiding any duplication of data inside the cache. My query is kind of language agnostic but very much programming related. My question is regarding the efficient caching of paged or filtered data but more than that, distributed caching. The latter I have decid...