.net

can you get XmlCompiledTransform progress?

Hello, I want to read an xml file, apply a transform, then write to another file. The best way I can think of is this: using (XmlTextReader reader = new XmlTextReader(new FileStream(_source, FileMode.Open))) using (XmlTextWriter writer = new XmlTextWriter(new StreamWriter(_destination))) { _xslTransform.Transform(reader, writer); } ...

Run code when a collection is modified (items added or removed)

I have a class that contains a list of objects. What's the best way to run some code in the class when the list is modified? class MyManagerClass { ArrayList list = new ArrayList(); // will likely be a different collection class private OnItemAddedToList(object o) { // how to call this? } private OnItemRemov...

Is using TransactionScope causing delete statements againist the database?

I am using LINQ to SQl and using TransactionScopre I am inserting the data in SQL . _context.tblDataContainer.InsertOnSubmit(migrationData); using (TransactionScope ts = new TransactionScope()) { _context.SubmitChanges(); ts.Complete(); } doing this, does linq execute any delete statements on SQL. i have checked using context...

How can i reduce the number of db round-trips with this Linq2Sql?

Hi folks, I've got the following Linq2Sql and it's doing more than one round trip for my 'SELECT' statement. I'm not sure why. First the code, then the explanation:- from p in db.Questions select new Models.Question { Title = p.Title, TagList = (from t in p.QuestionTags select t.Tag.Name).ToList() } Now the dat...

How to make Enter on a TextBox act as TAB button

Hello, I've several textboxes. I would like to make the Enter button act as Tab. So that when I will be in one textbox, pressing Enter will move me to the next one. Could you please tell me how to implement this approach without adding any code inside textbox class (no override and so on if possible)? Question is about C# and .NET ...

Best way to print from c# / .net?

What is the best way to print stuff from c#/.net? The question is in regard to single pages as well as to reports containing lots of pages. It would be great to get a list of the most common printing libs containing the main features and gotchas of each of them. [Update] for standard windows clients (or servers), not for web apps, pl...

How to get the parameters of an inline delegate?

Does anyone know if there is way to get the sender and the eventarguments passed to an event when using an inline delegate like below? p.Click+=delegate { //do some stuff }; ...

Do you know a good cache technology which can be used in .net to share data between a server and many client ?

I'm trying to adress the following issue: I have a server side .net application holding a Dictionary of PONO: the cache. I have many client side .net User interfaces which can query some of these PONO, either by using the key or by asking the server to filter only PONO with a specific attribute value: the clients Edit: Clients are C#...

Visual Studio hangs on build

When I try to build my projects in Visual Studio 2008, web sites won't build anymore, they hang on this stage: ------ Build started: Project: C:\...\Web\, Configuration: Debug Any CPU ------ Validating Web Site Building directory '/Web/Admin/Secure/'. Building directory '/Web/Admin/'. Building directory '/Web/Students/'. Building direc...

What's the best way to represent System.Decimal in Protocol Buffers?

Following on from this question, what would be the best way to represent a System.Decimal object in a Protocol Buffer? ...

nhibernate, class with parents and children causing duplicate keys.

Hi, any help you can give is very gratefully accepted. I've been looking at this problem over and over and cannot seem to find the solution. Its probably staring in me in the face :( I have the following class with a list of parents and children to be persisted in a Hierarchy table. class Item { public virtual int Id {get;set;...

O/R mappers that can update the database schema automatically?

Hi, Are there any O/R mappers out there that will automatically create or modify the database schema when you update the business objects? After looking around it seems that most libraries work the other way by creating business object from the database schema. The reason I'd like to have that capability is that I am planning a product...

Best solution for turning a website into a pdf

The company I work for we have a CBT system we have developed. We have to go through and create books out of the content that is in our system, I have developed a program that goes through and downloads all of the content out of our system and creates a offline version of the different training modules. I created a program that creates ...

Why is EventInfo.RemoveEventHandler throwing a NullReferenceException?

...

Traversing an arbitrary C# object graph using XPath/applying XSL transforms

I've been looking for a component that would allow me to pass an arbitrary C# object to an XSL transform. The naive way of doing this is to serialise the object graph using an XmlSerializer; however, if you have a large object graph, this could cause problems as far as performance is concerned. Issues such as circular references, lazy l...

Website/Web App Architecture Advice

Let me set the stage here. I'm a very junior developer who's recently made the transition from Network Admin who does some WinForms for his employer to a full-time development position working on an ASP.NET product that will be transitioning to Silverlight. I have precious little web development experiences. Some basic understanding of ...

Excel-like expressions in DataGridView

In Excel I can use an expression like "=C16+C17" for a cell to display values from other cells. In my application I need something similar. The user needs to be able to select a range of cells from a databound grind and display the sum in another cell (not in a footer!). So what I need is the ability to assign something like "Take the ...

How can I determine if an AD group contains a given DirectoryEntry from another (trusted) domain?

I am trying to beef up my code that determines whether a user is a member of a given AD group. It essentially works except when the member of the group happens to be from another (trusted) domain because it is stored as a foreignsecurityprincipal. Given that I have a valid DirectoryEntry object for both the Group I want to test, and the...

Parametise table name in .Net/SQL?

As the topic suggests I wish to be able to pass Table Names as Parameters using .Net (doesn't matter which language really) and SQL. I Know how to do this for values, i.e command.Parameters.AddWithValue("whatever",whatever). Using @whatever in the query to denote the Parameter. The thing is I am in a situation where I wish to be able to...

How can evaluate an expression stored as a string in F#

I want to do something sort of like this: let x = 5 let y = 10 let expr = Console.ReadLine() expr Where one might type "x+y" in the console to store in expr. How does one evaluate a statement like this in F#? Ultimately, I want a user to be able to enter expressions, or a set of rules for a system, on a webpage and have them saved ...