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
3
votes
3 answers

Poco+Entity Framework 4. Where should I add my methods for working with Poco classes?

I've tried to use Entity Framework 4 and POCO for my MVC 3 project. May be, I don't understand the main idea of this ORM, but the problem is following: I added ADO .NET Entity Data Model and make model according to database. I clicked Add Code…
Sir Hally
  • 2,318
  • 3
  • 31
  • 48
3
votes
4 answers

Set extended property via Linq-to-entities

I want retrieve the data, and set property that was added to entityobject(via partial class) on fly. How can I do that? this is my query: var ret = (from item in contex.Items select new Itemm { …
asker
  • 881
  • 2
  • 10
  • 15
3
votes
3 answers

C# WCF data contract partial class - new field in 2nd partial class not being picked up

I have a WCF service in which I have some data contracts. I'm using web service software factory, which uses a designer to create all the message and data and other contracts, and it creates them as partial classes. When the code is regenerated the…
Ciarán Bruen
  • 5,221
  • 13
  • 59
  • 69
3
votes
1 answer

How to create a XAML + CodeBehind pair in Rider?

(If that is even possible, of course; as of writing this, I am using the EAP 19 version, which is the latest release at the moment) I have a WPF project where I am trying to pair a XAML and a XAML.CS file together since they're both parts of the…
Linkyu
  • 200
  • 3
  • 9
3
votes
2 answers

Reasons for/against using partial classes for testing?

what are pros and cons of using partial classes for writing NUnit tests? I am going to start: pro: private methods can be tested con: TDD is not really possible anymore What else?
grady
  • 12,281
  • 28
  • 71
  • 110
3
votes
2 answers

.Net how to make a constructor for a partial class?

I have a partial class with a constructor, but the constructor is throwing an error because 'a member with the same signature is already declared' (a constructor of the same name exists in the other partial class). How do I make a constructor for a…
Erica Stockwell-Alpert
  • 4,624
  • 10
  • 63
  • 130
3
votes
0 answers

Methods from Partial Class

I'm using the tangible T4 example from the documentation and pull the classes as followed: // get all class items from the code model var allClasses = VisualStudioHelper.CodeModel.GetAllCodeElementsOfType(project.CodeModel.CodeElements,…
3
votes
4 answers

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…
Stacker
  • 8,157
  • 18
  • 73
  • 135
3
votes
0 answers

How to optimize a huge partial class project?

I recently took over a web project. The data layer is one auto generated class file separated in an independent project. I have no idea what tool they used to generate the class file. The problem: The file is a series of partial classes (5000+…
Albert_S
  • 599
  • 1
  • 4
  • 5
3
votes
4 answers

What is the significance of a sealed partial class?

In C#, what is the significance of a sealed partial class? A Sealed class is a class that cannot be inherited. A partial class is a class that can be split between 2 or more source files. So why does a "sealed partial class have any significance?
xarzu
  • 8,657
  • 40
  • 108
  • 160
3
votes
1 answer

Typescript : Add a method on a class from another module / Populate a namespace from different modules

The story I am building a modular library for math operations. I also want to divide the library into multiple modules : core, relational, vectors, and so on. The modules can be used on their own (but all depend on the core module) I know it's not…
Ludovic C
  • 2,855
  • 20
  • 40
3
votes
2 answers

Coded UI testing: What is the reasoning behind creating multiple individual UIMap classes instead of just multiple partial UIMap classes?

I am working on a project which includes a "semi-big" application GUI. There are about 4-5 individual(complex) pages I want to perform Coded UI Tests on, and I have gotten the impression that creating multiple UIMaps is the way to go! Sources: UIMap…
Yakitawa
  • 169
  • 1
  • 8
3
votes
2 answers

problems with extended classes and overwrite with methods

I have a .net website written in C# and will make functionalities that other developers can use. So I will make some default implementation and a developer can overwrite some methods Example: i have a class ShoppingCart and a class Product the class…
Marco
  • 2,306
  • 2
  • 26
  • 43
3
votes
4 answers

How can I extend a LINQ-to-SQL class without having to make changes every time the code is generated?

Update from comment: I need to extend linq-to-sql classes by own parameters and dont want to touch any generated classes. Any better suggestes are welcome. But I also don't want to do all attributes assignments all time again if the linq-to-sql…
csharpnoob
  • 505
  • 1
  • 9
  • 24
3
votes
2 answers

ColdFusion CFC implementation of C# Partial Class?

Does ColdFusion offer a mechanism for splitting CFCs into multiple files? I am NOT talking about extension, I am talking about splitting the SAME CFC into multiple files; the same way C# allows for "partial" classes. The reason for this is because…
Brian David Berman
  • 7,514
  • 26
  • 77
  • 144