.net

IQueryable<> from stored procedure (entity framework)

I want to get IQueryable<> result when executing stored procedure. Here is peace of code that works fine: IQueryable<SomeEntitiy> someEntities; var globbalyFilteredSomeEntities = from se in m_Entities.SomeEntitiy where se.GlobalFilter == 1234 select se; I can use this to apply global filter, and later use result...

Are there any dangers in using Visual Studio 2010 to develop .net 3.5 sp1 products?

We're excited at the prospect of upgrading our development IDE from Visual Studio 2008 to 2010. Our production environment, however, is not scheduled to be upgraded from .net 3.5 sp1 to .net 4.0 in the near future. What are the possible risks in using Visual Studio 2010 to develop production grade applications that will actually run on...

Webmethod not working when webservice published on other server - same data gives "Object Reference Not Set to an Instance of an Object"

Could it be a difference in .Net setup on server? Both have .Net 3.5 SP1 I can see both webmethods when I use url with .asmx name. Failing on Invoke... public int ReferLead(DataTransferObjects.ClientTransferObject request, List<DataTransferObjects.ClientDebtTransferObject> debtrequest) { object[] results = this.Invoke("Re...

MCV/MVP Patterns and Applications that interface with Hardware (DAQ/PLC/etc)

I've been reading a lot about the MCV and MVP patterns for use with UI and it seems like a really nice powerful way to handle user interfaces. I am - however - having a difficult time deciding how this could integrate into a system where data in the model is created from a Data Acquisition System or Serial/Ethernet devices. There is al...

Loading an Isolated dll into existing Appdomain and autoexecuting events

I have a solutions where three projects are running. One of my project is class library that is isolated from other two class. Now what I want to do is to load it into existing appdomain and auto execute its methods on some event occured from other assemblies in same domain. I have an event inside that, and i want to execute that event ...

how can I modify the drivers for a specific (any) NIC ?

I want to force one way communication only, between two computers in MS windows 2003 server OS for security purposes. ...

Difference between Delegate.BeginInvoke and Thread.Start

Existing related questions here talk about differences between: Delegate.BeginInvoke and Control.BeginInvoke Control.BeginInvoke and Thread.Start But what are the differences between Delegate.BeginInvoke and Thread.Start? ...

How to Mock the Internal Method of a class ?

I have a class which has a internal method and i want to mock the internal method . But i am unable to mock it i.e. it is not calling the mocked function but calling the original function. Is there any way to achieve this ? Edit:Actually i am a novice to the Moq. I have many classes and methods of the classes to test using the Moq. Man...

Force the use of interface instead of concrete implementation in declaration (.NET)

In C++, you can do the following: class base_class { public: virtual void do_something() = 0; }; class derived_class : public base_class { private: virtual void do_something() { std::cout << "do_something() called"; } }; The derived_class overrides the method do_something() and makes it private. The effect is...

Aggregate functions in Entity framework 3.5

Hello All: How can we aggregate function (MIN, MAX, COUNT etc) in Entity framework 3.5 in .net. Thanks Ashwani ...

Using ftp in C# to send a file

I'm trying to send a file using ftp. I have the following code: string server = "x.x.x.x"; // Just the IP Address FileStream stream = File.OpenRead(filename); byte[] buffer = new byte[stream.Length]; WebRequest request = WebRequest.Create("ftp://" + server); request.Method = WebRequestMethods.Ftp.UploadFile; request.Cre...

ASP.NET resources from external assembly always in fallback language

I have a separate project with .resx files compiled into a standalone DLL assembly, SomeNamespace.Localization. In another assembly, also used by the ASP.NET website in question, I reference some of the resources: htmlControl.InnerText = SomeNamespace.Localization.ErrorMessages.PleaseFillDate On the page in question, there is an Init...

How to prevent GetOleDbSchemaTable from returning duplicate sheet names from Excel workbook

Hi I have a function to return a DataView containing info on sheets in an Excel Workbook, as follows: Public Function GetSchemaInfo() As DataView Using connection As New OleDbConnection(GetConnectionString()) connection.Open() Dim schemaTable As DataTable = connection.GetOleDbSchemaTable(OleDbSchem...

.Net HttpWebRequest/Response Cocoa Equivelant

I am currently trying to port a .Net app to Objective C and Cocoa. I know the basics and have had little trouble with most things. But I'm having trouble retrieving data from the Web. In C# I would use POST and GET to retrieve information from a server as such byte[] buffer = Encoding.ASCII.GetBytes("someData"); HttpWebRequest request...

Problem with Regex in .NET (C#)

I'm trying to write a a regex to validate a string to match the following rules. Must start with a-z (case insensitive) Must only contain a-z A-Z 0-9 . - I've put something together based on my limited knowledge and ran it through an online testing tool for a whole bunch of situations and the results were as I had hoped however when ...

What Should I know to underestand LINQ better?

As LINQ is a good query language in dot net and everyone should be able to work with it. What are the necessary abilities which a programmer should have, before start learning LINQ. And after that, What should he know about LINQ? (important tips) ...

AJAX requests hang when streaming file from same domain, different handler

From some page I launch a GET request to some ASHX handler that streams a file to the client. Browser download dialog opens, download works fine. The problem arises when I want to continue to interact with the page. Interacting launches AJAX requests to some (different) handler to fill the page with content. But, as long as the download...

Does the Message to WndProc change value from 32Bit OS to 64Bit OS?

When the following Method is overrided in .NET it seems that I get different Messages in 32Bit and 64Bit OS:es. Can this be true? protected override void WndProc(ref Message m) I want to catch the following: private const int WM_LBUTTONDBLCLK = 0x0203; but WM_LBUTTONBLCLK seem to have another "Id" in my windows 2003 64 bit installation...

Issue while reading excel column names by using GetOleDbSchemaTable

After some google searching I found out how to read excel column names How To Retrieve Schema Information by Using GetOleDbSchemaTable and Visual Basic .NET . Though the sample is in VB.Net, I am using C#.net. My code is : public DataSet ReadXslToDataset(string fileName,string sheetName) { ConnectionString = ...

My .Net app needs local admin rights to run. Why?

I wrote a WinForms app using .Net and C#. The app accesses DirectoryServices and SQL databases. The new Win7 workplaces are not allowed to have local admin users and this app will not run. How can I identify the actions in the app which need local admin rights? SOLUTION The problem was caused by trying to write to the event log. This...