partial-classes

Entity Framework .. partial constructor

Hi .. I intend to extend the constructors of some of the entities in my Entity Framework (4). However how do I ensure that my constructor is run after the model has run its. i.e. I want to ensure that the the object holds the data from the database before I work on it in my constructor. ...

Override Attribute in Partial Class (DBML)

Hi, Is it possible to override an attibute set on a partial class? So I have one autogenerated partial class like this: [Table(Name="dbo.Users")] public partial class MbsUser : INotifyPropertyChanging, INotifyPropertyChanged { This is generated in my DBML. The problem is, I don't want my class to use this table. I've cr...

Redefine method return type in derived class without generics

TL;DR: Is there some way to add an abstract method to a base class that allows derived classes to override the method's return type, without the use of generics, and without the use of the new keyword? I'm working on developing some custom templates for LLBLGen Pro. In the process, I refuse to change the default templates that LL...

Partial class debugging

I have created a partial class for my xsd auto generated class. The problem is in debugging this partial class. Breakpoint are not recognized or the compiler doesn't break at the breakpoints set in the partial class. // Autogenerated class by xsd.exe public partial class Class1 { private Class1Brand[] brandField; private str...

How does EntityState, HasChanges, HasPropertyChanges work on Partial Classes ?

Hi, I have a class coming from EntityFramework which I have extended with a few properties in a partial class. I expose and edit the values of these properties in my interface and everything works fine. But, I want to detect the change of value in the properties in my ViewModel, and while investigating the EntityState, HasChanges, HasPr...

Partial class with same name method

I have a partial class like this public partial class ABC { public string GetName() { //some code here } public string GetAge() { //some code here } } public partial class ABC { public string GetSex() { //some code here } public string GetAge() { //some code here } } How these 2 c...

WPF, share methods between two UserControl classes

I have two UserControl classes, RequiredFields and OptionalFields. I wanted to have a base class, Fields, that would inherit from UserControl and contain methods that both RequiredFields and OptionalFields would use. However, when I try to do that, I get the following error: Partial declarations of 'MyNamespace.OptionalFields' must...

EF4 Model-First entities "non-partialable" when used in separate project.

I cracked open the tekpub EF4 series last weekend and replaced my subsonic stuff that I started with on a new site. I was a little miffed to find however, that with my entities in a separate domain project, I could not "partial" the entities on my MVC2 app. I did the awful thing of putting my EF4 model right in my app and then it worked ...

Partial User Control

In Asp.net Web forms why must a user control be partial? I tried to remove the partial keyword and it says: Missing partial modifier on declaration of type 'test'; another partial declaration of this type exists Where is the other declaration? I am trying to pass a generic type with the user control how can I do that? I can...

How do you deserialize Transunion XML?

Here is my attempt, xsd and classes created from xsd.exe Running my code I get error "There is an error in XML document (1, 2)." Inner exception {" was not expected."} Any help would be greatly appreciated. Thanks! XML Snippet: <xml> <creditBureau xmlns="http://www.transunion.com/namespace" xmlns:xsi="http://www....

asp.net mvc database model dynamic Properties

Hi All, Im just wondering how you go about creating dynamic properties on entities that generated from a database generated model. For example I have a UserInformation table. In that table it has basic information on the user (well derr) like user name, address details etc etc. I want to add a readonly property that concatenates the use...

Combine my Attributes on a Linq to SQL Entity Property

I have a Linq to SQL dbml.cs file with this in it: [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PantsName", DbType="VarChar(248)")] [global::System.Runtime.Serialization.DataMemberAttribute(Order=3)] public string PantsName { get { return this._PantsName; } set { if ((this._PantsName != value)) { this._PantsName = val...

Can I define properties in partial classes, then mark them with attributes in another partial class?

Is there a way I can have a generated code file like so: public partial class A { public string a {get; set;} } and then in another file: public partial class A { [Attribute("etc")] public string a {get; set;} } So that I can have a class generated from the database and then use a non-generated file to mark it up? ...

MVC 2 custom data annotations on partial entity class property not registering validation error?

Hi All, I have a data entity class which I have added a property to using a partial class: [MetadataType(typeof(LocaleMetaData))] partial class Locale { public sealed class LocaleMetaData { [Required(AllowEmptyStrings = false, ErrorMessage = "A locale must have a descriptive ...

override a method using a partial class

I have a class formed by two partial classes. One created by ORM code generation and one for extensions. In this particular instance, I need to override one of the properties generated by the partial class because I need to do some validation on it first. Is it possible to use my extension class to kind of override the property of the...

Business logic in Entity Framework POCOs using partial classes?

I have business logic that could either sit in a business logic/service layer or be added to new members of an extended domain class (EF T4 generated POCO) that exploits the partial class feature. So I could have: a) bool OrderBusiness.OrderCanBeCancelledOnline(Order order) .. or (IOrder order) or b) bool order.CanBeCancelledOnline(...

Partial classes in separate dlls

Is it possible to have two parts (same namespace, same class name) to a partial class in separate DLLs? ...

What does the partial mean?

public partial class Form1 : Form What does the partial in this declaration mean? I understand we have a class Form1 that inherits from Form. But what does the partial mean? ...

Form designer breaks on generic abstract UserControl

I have a generic abstract UserControl class, SensorControl, which I want all my sensor control panels to inherit from. The problem When attempting to design the EthernetSensorControl (one of my inherited UserControl forms, from within Visual Studio, the following error is displayed in the form designer: The designer could not be show...