I have some extra functionality i need to add which includes adding a new property to an object and extending methods in another class that handles this object. I'm dealing with source code of a product (in C# 2.0) we use which i really don't want to modify, i just want to extend on it.
I'd ideally like to have a separate assembly to d...
I have a small web application.
This is what I want to do: Create partial classes to split up a code behind file.
Why am I not able to create partial classes directly?
If this is the codebehind file:
using System;
using System.Configuration....
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object ...
I'm creating an abstract class that can be inherited in a partial class of a LINQ to SQL class. The LINQ to SQL class contains a bunch of built-in partial methods. Is there a way that I can implement one or more of the partial methods in the abstract class? I know that partial methods can only be contained within partial classes or struc...
I'm using .net 2.0. I'd like to place one of my C# methods in an inline server script block inside my ascx file because I need to update it a lot while designing. This way I don't have to compile my large project everytime.
I would like to call the method from inside my code behind file. I use to do this by inserting a virtual stub m...
I am extending LINQ to SQL entity classes using partial classes, and I'm wondering how to best reset some properties on the entity objects to their default state.
My partial classes uses no unmanaged recourses. And as far as I can tell; neither does the LINQ to SQL entity classes. So I'm thinking that I'll implement IDisposable and hand...
I have a WCF service that generates loads Entity Framework objects (as well as some other structs and simple classes used to lighten the load) and sends them over to a client application.
I have changed 2 of the classes to implement an interface so that I can reference them in my application as a single object type. Much like this examp...
Guys, I have the follow VB.NET class definition:
<Serializable()> Partial Public Class Customers
End Class
Inside another file I have the same thing (with different methods and variables of course). When I compile, I get the following error:
Attribute 'SerializableAttribute' cannot be applied multiple times.
The error is pretty self...
I would like to implement some business rule validation like Scott Guthrie did in his MVC Nerddinner tutorial (http://nerddinnerbook.s3.amazonaws.com/Part3.htm), but I'm running into a problem trying to do so.
Scott was using Linq to SQL in his tutorial. He creates partial classes for his data objects, and then he implements a partial ...
Hi,
Is there any overhead using partial classes in case of memory, performance etc?
If we create a partial class can we identify whether the class was partial or not using reflector??
...
Okay, so we have a utility here in-house that generates business-model classes from our database tables and views, similar to (but not quite exactly like) an ORM. In maintaining it, it occurred to me that the data in the schemas isn't likely going to change a whole lot. The functionality, however, might. We may want to add additional fun...
I have been reading Programming Microsoft® Visual C#® 2008: The Language to get a better understanding of C# and what can be done with it. I came across partial classes which I had already encountered from ASP.Net's Page class.
To me it seems that you can do what partial classes do with an abstract class and an overridden one. Obviously...
I'm trying to extend the linqtosql classes generated by the VS designer and need to determine if the value of a specific field has changed. Is there a way for me to access the before and after values for a field in the DataContext Update method for a table/entity?
Here's my code:
public partial class DataClassesDataContext
{
parti...
How do I program a partial class in C# in multiple files and in different namespaces?
...
I used the xsd.exe tool to generate a class based on my xml schema. It created a public partial class with DebuggerStepThroughAttribute. Well, I created another partial class file for this class to write my custom code and want to be able to step-into this code I've written but it appears the debugger is applying the step-through attri...
Hey all,
I am trying to add a property to one of the generated data classes the Entity Framework has created for me. I have done the exact same thing on another generated class without a problem and for some reason it won't work on this one.
The only difference between the two generated objects is one is just a straight table mapping ...
I am creating a conversion class for frequency, and I wanted to allow my team to be able to add additional conversions when they are needed.
Frequency myFrequency = new Frequency(100, MHz);
double value = myFrequency.InKhz();
The source code for the class will not be include in future projects, so I will either have to have the clas...
Hi
I have a Subsonic3 Active Record generated partial User class which I've extended on with some methods in a separate partial class.
I would like to know if it is possible to add Data Annotations to the member properties on one partial class where it's declared on the other Subsonic Generated one I tried this.
public partial class U...
Hello,
I'm very new to C# so please bear with me...
I'm implementing a partial class, and would like to add two properties like so:
public partial class SomeModel
{
public bool IsSomething { get; set; }
public List<string> SomeList { get; set; }
... Additional methods using the above data members ...
}
I would like to i...
We're using sqlmetal to generate our DBML, run it through a transformation, then use sql metal to generate the DataContext classes -- additionally, I want to automatically generate some validation for the entities based on some metadata that we store in the database about each entity and it's attributes. For example, if an entity has wha...
Why is the code behind a partial class for aspx pages?
...