Hi,
My question is as follows:
I have a base controller (ASP.Net MVC controller) called ApplicationController, and I want all my controller to inherit from it. this base controller has a ILogger property, marked with a [Dependency] attribute. (yes, I know I should use constructor injection, I'm just curious about this attribute).
I cre...
If I inherit one DBML file from another DBML file, is it possible to visually create associations to the data classes from inherited DBML?
...
The scenario is I am changing the status of a "request" and sometimes the new status is transitory and needs to immediately change to another status. So I'm in a method in my base class, WorkflowCommandBase:
public virtual Request Execute()
{
ChangeRequestStatus();
QueueEmails();
TrackRequestStatus();
...
This is the scenario:
class BaseClass
{
public virtual string Prop {get; set;}
}
class ChildClass : BaseClass
{
public override string Prop {get; set;}
}
//program
...
ChildClass instance = new ChildClass;
Console.WriteLine(instance.Prop); //accessing ChildClass.Prop
...
The question is how to access BaseClass.Prop in a inst...
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'm looking at this data model I've come up with and not feeling comfortable. I've changed the entity names so it (hopefully) makes more sense. In any event, how would you model the following?
I have 3 entities. GovernmentCustomer, PrivateCustomer, PublicCustomer. Private and Public Customer are both CorporateCustomers. Corporate and Go...
Assuming I have 5 tables. Can ActiveRecord handle this? How would you set it up?
The hierarchy:
Account (Abstract)
CorporateCustomer (Abstract)
PrivateCustomer
PublicCustomer
GovernmentCustomer
Edit: In nhibernate and castle activerecord the method needed to enable this scenario is called "joined-subclasses".
...
I apologize if this question is long. This was part of a blog post I did some time ago, and a reader suggested me to post it on stackoverflow. I trimmed it a bit though.
Suppose you have the following situation
#include <iostream>
class Animal {
public:
virtual void speak() = 0;
};
class Dog : public Animal {
void speak() { s...
Hi,
I have a custom attribute which is applied to class properties and the class itself. Now all the classes that must apply my custom attribute are derived from a single base class.
How can I restrict my Custom Attribute so that it can be applied to only those classes, that must derive from my base class? How do I do this ?
Thanks,
...
I'm changing some classes of mine from an extensive use of getters and setters to a more pythonic use of properties.
But now I'm stuck because some of my previous getters or setters would call the corresponding method of the base class, and then perform something else. But how can this be accomplished with properties? How to call the pr...
When I press f12 on the ArrayList keyword to go to metadata generated from vs2008, I found that the generated class declaration as follows
public class ArrayList : IList, ICollection, IEnumerable, ICloneable
I know that the IList already inherits from ICollection and IEnumerable, so why does ArrayList redundantly inherit from these in...
I've got a WPF application where PageItems are model objects.
My main ViewModel has an ObservableCollection of PageItemViewModels, each one building itself from its matching PageItem model object.
Each PageItemViewModel inherits from the abstract class BaseViewModel in order to get the INotifyPropertyChanged functionality.
Each PageIt...
Currently I have database with the following associations:
One Client to Many Intakes
One Intake to Many CaseManagements
One CaseManagement to Many Interventions
Client, Intake, CaseManagement are single classes per table
Intervention is a class-hierarchy-per-table.
Currently, if I do something like this:
var client = new Client()...
Hi,
I am doing the below test to try and learn more about LINQ to SQL.
I have got an Activities table which contains an activityId, parentId, type.
The type is used as a discriminator value, to say whether it is an activity, task or project.
I have an Activity, Task and Project class that inherit from Activity, it seems wrong for Tas...
for short, this could be paraphrased like "inheritance versus function library"
for example, I'd like to add a method to the javax.servlet.http.HttpServletRequest that gives me the whole body, a getBody() method that would read the body thru the getReader method, just to put an example.
In other languages, like ruby or javascript, you ...
Why does the derived class have to declare its methods as virtual for dynamic binding to work even though the methods of the base class are declared virtual?
...
Let's say I have the following code:
interface ISomeInterface
{
void DoSomething();
void A();
void B();
}
public abstract class ASomeAbstractImpl : ISomeInterface
{
public abstract void A();
public abstract void B();
public void DoSomething()
{
// code here
}
}
public class SomeImpl : ASomeA...
I have the following existing classes:
class Gaussian {
public:
virtual Vector get_mean() = 0;
virtual Matrix get_covariance() = 0;
virtual double calculate_likelihood(Vector &data) = 0;
};
class Diagonal_Gaussian : public Gaussian {
public:
virtual Vector get_mean();
virtual Matrix get_covariance();
virtual double calculat...
I am trying to save myself a bit of typing by writing the following code, but it seems I can't do this:
class lgrAdminObject(admin.ModelAdmin):
fields = ["title","owner"]
list_display = ["title","origin","approved", "sendToFrames"]
class Photos(lgrAdminObject):
fields.extend(["albums"])
why doesn't that work? Also since t...
Here is what I am trying to do:
if (a==true)
{
dbA objectInstance = new dbA();
}
else
{
dbB objectInstance = new dbB();
}
objectInstance.Name = "New name";
I get "the name objectInstance does not exist in the current context", I assume because the def happens inside the conditional.
There must be a better pattern to do this...