When I have entity B inherit from entity A using table-per-type for storage and try to write a Linq query that filters on a property on B, for example
Function(b) b.name="Joe"
I get the error
The specified type member 'name' is
not supported in LINQ to Entities.
Only initializers, entity members, and
entity navigation proper...
I am building a product, and I need a way to generate code at the runtime. Currently, I use VB.Net (only for this and nothing else) xml literals (is that what they are called?), to create templates and create code at runtime. My question is, can I use T4 on web server in shared hosting, without VS installed, to generated code at runtime?...
When reading online discussions about MVC frameworks, I hear a lot of commentary pointed toward PHP projects like Cake, Code Igniter and Symfony from Java/.NET developers in the vein of "those are clever hacks, but not true MVC".
So, what makes something a "true" MVC framework. i.e. what's an example of a .NET or Java MVC framework th...
In the code below, sometimes someFunctionCall() generates a "Thread was being aborted" exception. How come the code in code block B never runs? Does ASP.NET start a new thread for each method call? I was suprised to see that when this exception happens the code in block b never runs, the method returns, and my application keeps running. ...
Suppose I have a class that represents a product to be priced using one of a number of different pricing strategies. This pricing occurs hundreds of times per second, so to eliminate repetitive if/else statements I am instead using a delegate to launch the appropriate strategy, like so:
Private Delegate Sub PricingModel(ByVal params As ...
Visual studio is giving the error PRJ0019: A tool returned an error code from "Copying DLL...". The console window includes the output: 'CopyDLL.cmd' is not recognized as an internal or external command.
Here is some background as to why I don't know about the tool which is copying. Someone left the company a year ago and forgot to chec...
Ok, the short version is that I have a Linq entity from a LinqDataSourceUpdateEventArgs and I need to handle the Update manually because MS was stupid.
I can get the Table object from the data context, which allows me to, well, this:
var newObj = e.NewObject;
var table = FormContext.GetTable(e.NewObject.GetType());
table.Attach(newOb...
HI,
I have set up CruiseControl for .NET with SVN as my source control and using NAnt build script. When i manually build the visual studio solution i get the errors, which is correct coz i have some bad code. After i checked in the code to svn, CCNet triggered the build, but the result shows as SUCCESS. Please find the config and buil...
As we all know by now, XSS attacks are dangerous and really easy to pull off. Various frameworks make it easy to encode HTML, like ASP.NET MVC does:
<%= Html.Encode("string"); %>
But what happens when your client requires that they be able to upload their content directly from a Microsoft Word document?
Here's the scenario: Peop...
Behold the code:
using (var client = new WebClient())
{
using (var stream = client.OpenWrite("http://localhost/", "POST"))
{
stream.Write(post, 0, post.Length);
}
}
Now, how do I read the HTTP output?
...
Is there any way to write an integration test to test that the FetchMode.Eager works correctly? I want to verify that it's not going to the database when I retrieve MySubObject.
The code:
public MyObject GetEager(string name)
{
return Session
.CreateCriteria(typeof(MyObject))
.SetFetchMode("MySubObject", FetchMode....
Behold the code:
using (var client = new WebClient())
{
try
{
var bytesReceived = client.UploadData("http://localhost", bytesToPost);
var response = client.Encoding.GetString(bytesReceived);
}
catch (Exception ex)
{
}
}
I am getting this HTTP 500 internal server error when the UploadData method ...
I've been using IronPython for a while now, but something which really hampers my development with it is that it is excruciatingly slow to start up. I love the language and it's way of working, but it is frustrating to have to wait upqards of 20 seconds before it starts executing my code.
I have done some digging and it seems to be th...
I have declared a generic event handler
public delegate void EventHandler();
to which I have added the extension method 'RaiseEvent':
public static void RaiseEvent(this EventHandler self) {
if (self != null) self.Invoke();
}
When I define the event using the typical syntax
public event EventHandler TypicalEvent;
then I...
Is there any light version of richtextbox control? I've got to create like 300+ of them in an app which takes time, memory and slows everything down... All that I need is to have a control that will enable me changing the background/foreground of a part of the text... I'd need that in winforms... anybody know anything about some kind of ...
We have a project that needs to be build for both .Net 1.1 and 2.0 due to server compatibility issues (Windows Server 2000 and Windows Server 2003 production servers). I am looking for help making the decision between conditional compiliation or branching the code in source control. There are pros and cons for each. Thanks in advance....
I keep getting an exception about Linq to Entities not supporting certaion query expressions like this:
MyDataContext db = new MyDataContext()
Brand = db.Brands.First(b => b.BrandId == Int32.Parse(brandIdString))
I'm not attempting to pass along the string parsing on to the entity store, I just want to parse that string into an integ...
I want to convert tif to an image type that is viewable in a web page.
The tifs are black and white so jpg does not work well at all and end up even larger.
Here are some tests I have made so far using C# and Image.Save to do the conversion:
Orignal tif is 7KB (bit depth: 1).
Converted to:
JPG: 101KB (bit depth: 24)
BMP: 256KB (bit...
In a SQL Server 2008 database, I have a table with a column of type varbinary.
Currently, I am using LINQ to SQL to access the database.
I already know that I can delay the loading of the column. However, I wish to consume less memory by not loading all of the bytes from that value.
Ideally, I would like to have a Stream to those bytes.
...
I need to iterate a collection of objects. Based on a property value of the object, I need to group objects together. I also need a total count of each discrete property value. I do not know how many groups there will be and there could be 1 to n objects in each group.
How do I do this? Are there algortihms that could help me out with t...