.net

Testing Linq to Entities Queries

What is the best way to do this? Typically when I create a Query in SQL I create it in the designer of visual studio and I run it multiple times to see my results.... Is there such a thing for Linq-to-Entities? ...

[C#] Is There Anyway to Read a Webpage's Text Faster?

I need to read the text of a webpage programmaticly (not html source, but it doesn't matter). It takes too much time with "WebClient().DownloadString()" and the time is very important in the program. Any tips to do that faster? Thanks... ...

Delete linkbutton not firing inside a gridview inside an update panel

Looked to various posts on here but couldn't find one quite like it, I know this is going to be something small but I just can't figure it out. I am using a gridview inside an update panel. The gridview is using the auto generated delete column converted into a templatefield column. Here is the code: <asp:GridView ID="gvFiles" runat="s...

.net Fluent Validation abstract property SetValidator problem

I have the following code using FluentValidation but it is not possible to call SetValidator(FredAnotherClassValidator()) because it is not of type IAbstractAnotherClass The compiler error is The type 'IAbstractAnotherClass' cannot be used as type parameter 'TCollectionProperty' in the generic type or method 'FluentValidation.DefaultV...

Is there any way to use SqlTypes with a SqlDataAdapter?

I'm trying to write some simple C# code that will select some data from a SQL Server instance, modify the data, and update the changes back to the database. But I'm having a hard time figuring out exactly how to do this. Here is a simplified version of my code: using (SqlConnection conn = new SqlConnection("Server=(local);Integrated S...

C# Linq XML pull out nodes from document

Hi I’m trying to use Linq XML to select a number of nodes and the children but getting terrible confused! In the example XML below I need to pull out all the <MostWanted> and all the Wanted with their child nodes but without the other nodes in between the Mostwanted and Wanted nodes. This because each MostWanted can be followed by any ...

possible memory leak in a singleton?

I've asked this question before with no real answer. Can anybody help? I'm profiling the below code inside a singleton and found that a lot of Rate objects (List<Rate>) are kept in memory although I clear them. protected void FetchingRates() { int count = 0; while (true) { try { if (m_RatesQueue.Count > 0) { ...

how to compare two column value in GridView?

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { string[] Cardio = (string[])objDocter.getDocter_acc_prof(); if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[2].Text == "Heart problem") { DropDownList ddlAssignDoc = (Drop...

Quote from MSDN about System.Web.HttpApplication

Quote from http://msdn.microsoft.com/en-us/library/4wt3wttw.aspx: One instance of the HttpApplication class is used to process many requests in its lifetime. However, it can process only one request at a time. Thus, member variables can be used to store per-request data. Why per-request? Maybe per set of requests? Seems t...

Building a byte array in PHP with variants?

Hi, I am trying to build a byte array in PHP using Variants. However, I can't seem to make it work. Here's a sample code: $ie = new COM("InternetExplorer.Application"); $ie->Visible = true; $ie->Height = 500 ; $ie->Width = 700 ; $post = array (ord('p'),ord('='),ord('1')) ; $v = new VARIANT($post, VT_ARRAY|VT_UI1); $ie->Navig...

How to translate ObjectStateEntry.OriginalValues into Entity?

How to translate ObjectStateEntry.OriginalValues into Entity? I thought I can do this with ObjectContext.Translate method but I have to pass DataReader instead. Is there any ways? ...

What does return type of ICollection<Person> mean?

I'm looking at some code samples for Entity Framework 4 and the author created a method that returns ICollection<Person>. I know ICollection is an interface. I know Person is the type of object in the collection. I know I'm getting back a collection of Persons. The question. Why ICollection? Why not List<>? Why is an interface being use...

WPF DataGrid: modify all selected items.

I want to take all rows that are selected and modify one column value in each of them. I tried this but it doesn't work. foreach (System.Data.DataRowView DRV in ItemDataGrid.SelectedItems) { DRV.Row.BeginEdit(); DRV.Row.ItemArray[6] = true; DRV.Row.EndEdit(); } Anyone know how to do this? Thanks, Matt ...

Testing for EndPoint compatibility with IIS hosted WCF service.

I am trying to deploy a WCF service to IIS. I would like to offer both HTTP and HTTPS endpoints, but Im not guaranteed that the IIS servers will have HTTPS available. If its not, then my service will fail start. Is it it possible to test if an endpoint is viable before adding it to the service? Right now i am limited to using .NET 3....

The call is ambiguous between the following method or properties in ASP.NET MVC RenderAction

The call was working fine until I installed ASP.NET MVC 1.0 RTM. Error: CS0121: The call is ambiguous between the following methods or properties code snippet <%Html.RenderAction("ProductItemList", "Product"); %> Action Method public ActionResult ProductItemList() { return View("~/Views/Product/ProductItemList.ascx", _repository....

Unexpected IOException

I have the following code that produces an IOException upon the second call to Console.WriteLine (but not the first).... This is following some calls to a DLL, but as far as I can tell, the functions returned just fine. Console.WriteLine("Finding Cameras"); //Works uint camera_count = 0; CamDLL.Camera[] cameras = new CamDLL.Camera[100];...

Check for network connectivity

I am building a simple application that listens to NetworkAvailibilityChanged Event. It's all good, except in the case of a modem PPP interface connection, where the app gets notified of the availibility only when the network is connected but not when disconnected. Am I missing anything? I tried it for LAN and it worked perfectly. ...

C#- What is the best way for write text to a file from array of strings.

Group, I'm looking for new and fun ways to write an array of strings to a .txt file. -This file will be rewritten every time its called and saved. -The file name will be dynamic enough that the .exe will know what string goes where. For example: ~/someFile.exe "fileName" "string|string|string|" -In this example someFile.exe is ca...

Best way to access a Rails 3 REST-ful web service using a VB.NET consumer?

What is the best way to access a Rails 3 REST-ful web service, developed using standard Active Resource techniques including HTTP authentication over SSL, from a VB.NET consumer? Consumer can be .NET 4.0 if that is necessary. Are there any .NET libraries yet that can bridge the gap? I have already come across links like this (http://...

Compiled .NET application - get property value at runtime

I have a piece of software, which is obfuscated. I need to get value of a specific property it assigns to a control. EXE deobfuscation isn't an option. Is there any tool I can use to get the value at runtime? Can it be done in debugger, if yes, then how? ...