Questions tagged [partial-classes]

With this keyword classes can be split into multiple definitions, but it compiles into one class.

With this keyword, classes can be split into multiple (mostly two) definitions, but the code compiles into one run-time class.

References

441 questions
0
votes
1 answer

Move WinForm some controls to another WinForm using partial classes in C#

I have a WinForm which has many panels, and each panel has many controls, which make it very hard to handle the design of this form, how to move each panel to a new form and return all panels to the main form at runtime?
T.Hajjar
  • 77
  • 1
  • 5
0
votes
1 answer

How to inherit a partial class from user control to other one?

I've a problem with two user controls, first of all I've a user control named "Base" and I want to inherit it from another user control named "MyControl" but the "Base" control is a partial class and the user control "MyControl" just have a public…
0
votes
2 answers

Compilation errors when adding new properties to C# partial class generated by an EDMX

I've got an EDMX diagram generated from a SQL Server database. It generates a partial class like the following:- public partial class Profile { public Profile() { // Constructor Info here } // Various string/int/bit…
Mike Upjohn
  • 1,251
  • 2
  • 16
  • 38
0
votes
3 answers

asp.net partial classes

I want to create two partial classes for the single aspx file. I am using vs2005 dotnet 2.0. i could not able to access method from one partial class in another partial classes. Can anybody assist me. Partial class 1 : my main aspx page public…
muthukumarm
  • 197
  • 4
  • 14
0
votes
1 answer

Base class '' specified for class '' cannot be different

"Base class specified for class '' cannot be different from the base class '' of one of its other partial types" The problem is that I only declared the class in one place, the actual class file, and only declared it once, non…
William Tolliver
  • 305
  • 1
  • 2
  • 16
0
votes
2 answers

EF partial classes and default values

Following on from an SO dicsussion here, I have implemented partial classes so as to create default datetime values for my Created and Modified database fields in a Constructor. Now the problem is that my database has 100+ tables, and 75+ of them…
Darbio
  • 11,286
  • 12
  • 60
  • 100
0
votes
3 answers

Using Partial classes for autogen code, how to setup filenaming etc?

I have a datalayer.cs file that was generated using a code gen tool. I am marking the class as a partial class, so I can create another file with my own hand written datalayer code. How should I name my files? Should I do it like…
Loadman
  • 8,797
  • 3
  • 17
  • 3
0
votes
3 answers

Modifying / Adding to C# Partial Classes

I have got a partial class in my C# project i.e. auto-generated code from Entity Framework. Now I want to modify or add some more functionalities, properties or methods to that class. I have the auto-generated class code under…
maliks
  • 1,102
  • 3
  • 18
  • 42
0
votes
1 answer

asp.net mvc database model dynamic Properties

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,…
Matt
  • 3,305
  • 11
  • 54
  • 98
0
votes
0 answers

Tracking OriginalValue of user defined properties in Entity Framework

Suppose I have a database table User with a 1:1 relationship with table Role. The class generated by Entity Framework would be: // Generated by Entity Framework public partial class User { public int ID { get; set; } public string Name {…
user1447435
  • 145
  • 1
  • 10
0
votes
2 answers

Best alternative approach to define a Partial Module in Vb.Net

SCENARIO Imagine that you, the programmer, is developing an API with a module file lets say BitmapExtensions.vb which is full of extension methods, each extension method has for example 20 overloads, and this causes the source code to increase…
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
0
votes
1 answer

Class in ASP.NET Partial Class in App_Code

I created a class for connection and using with register.aspx without any problem. When i try to move codes from register.aspx.cs to regpartial.cs then i get an conflict error: "connection conn = new connection();" I would like to move codes…
Cagatay
  • 333
  • 1
  • 3
  • 13
0
votes
1 answer

Entity Framework DB First and 'override' keyword

Suppose I have the class public class Parent { virtual string Name {get; set;} } public partial class Child : Parent { } When I use EF DB first, it generates the following: public partial class Child { string Name {get; set;} } How do I…
Husain
  • 784
  • 1
  • 9
  • 22
0
votes
1 answer

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…
George R
  • 3,784
  • 3
  • 34
  • 38
0
votes
1 answer

(Partial Class) Dividing a class into multiple classes

Basically what I want is to divide a class into multiple classes. I've tried using the partial function but it seems that I can't get it to work. What I want to do is to make multiple classes for the 100+ Regions under case Action.Answer: as you can…
Noobzilla
  • 97
  • 1
  • 1
  • 6