.net

Configuring a DateTime column to update from db time

Is it possible to configure Linq to SQL to update a column as getutcdate() (ie. obtain the date from the db server, rather than the web server), or is a trigger my only option? I have tried setting the Time Stamp property on the model, but that did not help. Any thoughts? ...

WSE 3.0 Content Based Routing Gives me error "Message Information Header Required"

I'm trying to use content based routing to route my requests to different versions of the web service depending on what they pass into the "UserName" parameter. Thus one user may get presented version 1 of my web service and another gets version 2 of my web service. After much research, I stumbled upon WSE and found an example here: ht...

UTC to local time using Linq to Entities

Hi all I need to translate a field from UTC to local time in a LINQ to Entities query. But it does not recognize the method 'System.DateTime ToLocalTime' that I was intended to use. My query was that way: Select requests for which doesn't exist any other request in the same day in local not yet resolved. Having into account that Inco...

ASP.NET MVC problem using image submit tag in Ajax.BeginForm

I'm developing a web app with ASP.NET MVC 2 (.NET 4.0), and I've run into a difficult problem. I've got the following code in a partial view: <% using (Ajax.BeginForm("CompleteTask", "Agenda", new AjaxOptions {HttpMethod = "POST"})) { %> <%: Html.EditorFor(x => x.Remarks) %> <%: Html.HiddenFor(x => x.TaskId) %> <%: Html.Hid...

How to do Data Annotations on an object in another Assembly?

I have an abstract domain object that is consumed by both a web and windows application. This domain object sits in a an old namespace along with any derived classes. For my web application I would like to use data annotations. Usually I would create a partial class to the domain object and provide it a MetaData class. However, I am una...

C# 4.0 Tasks - Subclassing or Displaying Execution Tree?

Hi there, do you have any advice on how i might visualise a Task Tree? I will be running a large set of long running tasks which each have some child tasks, i want to visualise the running of the execution to the user ideally in a tree / DAG. If possible i would like to use the new Task Parallel Library My first thought is to subclas...

How to customize registration page for silverlight business application?

When you create a silverlight 4 business application, using VS2010, by default you will get a login and registration page. I need to customize the registration page, to add more fields. How do I do that? Thanks in advance. ...

Using TFS 2010 to branch(make a copy) .Net application

I have a LOB app that we use internally that is Winforms with a Linq to SQL DAL. I want to make a copy of this so that we can test some major changes going forward. We use TFS 2010, is this what branching can do? I need to be able to edit GUI and DAL while being able to deploy it side by side with the Live version. Then, once the c...

How to create a .Net programming language?

I have created a few different full programming languages using some of the various parsing tools available. However, how would someone create a programming language that runs the .Net framework? Would I have to output the .Net IL and compile that or is there a higher level of abstraction? Also, is there an easy way to get the language ...

SecurityException with Windows Service in .NET4

I have a .NET (v4) application running as a Windows Service. I also have an ASP.NET web site (also v4) that makes calls to the service using remoting. This has worked with .NET3.5 and 2 for a while but in .NET4 some functionality is failing due to some security constraints. I keep getting an error: 'System.Security.SecurityException: R...

Determine if a string contains a base64 string inside of it

I'm trying to figure out a way to parse out a base64 string from with a larger string. I have the string "Hello <base64 content> World" and I want to be able to parse out the base64 content and convert it back to a string. "Hello Awesome World" Answers in C# preferred. Edit: Updated with a more real example. --abcdef \n Content-Type:...

Why we use flush parameter with Encoder.GetBytes method

This link explains the Encoder.GetBytes Method and there is a bool parameter called flush explained too . The explanation of flush is : true if this encoder can flush its state at the end of the conversion; otherwise, false. To ensure correct termination of a sequence of blocks of encoded bytes, the last call to GetBytes ca...

Questions related to Installing Silverlight on Mac

We are planning to develop a Silverlight 'cross platform' application, that is expected to run on both Windows and Mac with elevated permissions. Mono alone is not an option, as the application requires Silverlight specific video features, supported only in SL 4.0 So, here are some considerations. 1 - The 'Application', should interfa...

ToolTip Stay displayed

In C#, how can I make a ToolTip remain displayed until the mouse move out of the ToolTip region. No matter what delay I set it stay displayed. I tried to change AutoPopDelay, InitialDelay, and ReshowDelay properties to 0 but the only way I can see is to set the delay to a very large value which is not what I'm looking for. ...

Double escape XML File

Hi! I have a simple xml file like this one: <xml> <check> <a>b&lt;</a> <b> <test>asdf</test> </b> <test>jj&amp;j</test> </check> </xml> I would like to "double escape" all special chars so it will result in &amp;lt; and &amp;amp; with a simple linq to xml statement. The xml should still be valid, only the v...

Design time exception not caught in .Net Winforms

I have a form that is used at design-time to configure various properties. I've tried two ways to do a form-level catch all exception: (1) I add a handler to Application.ThreadException in the constructor. (2) I wrap the Show method, of the form, in a Try/Catch block Both of these work at run-time when I test by adding a property gri...

Resolve generic service

I got the following service: IRepository<TEntity, TPrimaryKey> ..for which I've created an implementation defined as: Repository<TEntity, TPrimaryKey>. How do I register it in autofac so that I can resolve it as: IRepository<User, int> ...

[.NET] Sending a search query over SOAP

I have a few thousand objects that are in memory and of a few class types (ie: Products, Relationships, Categories, etc). Each object has properties such as Name, Price, ManufactureDate, etc. I would like to expose these objects through a wcf service and allow consumers to search, filter and maybe even do basic joins on these objects. I ...

.NET - How can I change the Date format by creating a new Culture in .NET?

My code is like this: CultureAndRegionInfoBuilder cib = new CultureAndRegionInfoBuilder("eh-sim", CultureAndRegionModifiers.None); cib.LoadDataFromCultureInfo(new CultureInfo("en-us")); cib.LoadDataFromRegionInfo(new RegionInfo("US")); cib.CultureEnglishName = "Versão de teste"; cib.NumberFormat.CurrencyDecimalSeparator = " "; cib.Re...

need a regex for a positive max 2 digits after . floating number

Hi I need a C# regex for a positive floatin no with maximum 2 digits for decimals. Also the regex should check for letters and alphanumerical chars (not allow them) and not allow also the input value to be empty (0 characters). Thanks ...