self-referencing

Is there a way I can inline a function to an Action delegate and referenced it at the same time?

Is there a way I can inline the delegated task instead of separating it on another function? Original Code: private void ofdAttachment_FileOk(object sender, CancelEventArgs e) { System.Threading.ThreadPool.QueueUserWorkItem((o) => Attach()); } void Attach() // I want to inline this function on FileO...

Eager loading of Linq to SQL Entities in a self referencing table

I have 2 related Linq to SQL questions. Please see the image below to see what my Model looks like. Question 1 I am trying to figure how to eager load the User.AddedByUser field on my User class/table. This field is generated from the relationship on the User.AddedByUserId field. The table is self-referencing, and I am trying to figu...

Composite Key on a Self Referencing Table

We have a composite primary key for the site table defined below. Functionally, this does exactly as we would like it to. Each site should have a parent site of the same district. Defining the table in this way allows specifically for that. CREATE TABLE [dbo].[site]( [site_number] [nvarchar](50) NOT NULL, [district_id] [bigint] ...

Is there a better way to self reference a type?

I'm finding lately a lot of code smells related to referencing generic classes in C#. My gripes especially apply to those classes which inherit from DependencyObject and contain DependencyProperties. The basic problem is that when declaring a dependency property one generally references the current type which is also known as the owner...

Python: How do I get a reference to a module inside the module itself?

How can I get a reference to a module from within that module? Also, how can I get a reference to the package containing that module? ...

Why don't statements that don't do anything throw an exception (or warn the developer)?

I've been bitten a couple of times by statements in VB.NET (not sure if this effect exists in C#) that appear to be self-referencing, but when they're executed, they don't actually do anything because they require a target and one isn't provided. For example: Dim MyString as string = "String to test" ' Neither of these lines do anythin...

Edit of self referencing HABTM in cakephp works, sometimes

I'm using a self referencing HABTM model with Participants. You sign up for an event and when you log in to your reservation/profile you see a list of other participants and you can choose to add yourself and others into various groups; share hotel room, share transportation from airport etc. What I've managed so far: 1) In my profile...

Fluent NHibernate Self Referencing Many To Many

I have an entity called Books that can have a list of more books called RelatedBooks. The abbreviated Book entity looks something likes this: public class Book { public virtual long Id { get; private set; } public virtual IList<Book> RelatedBooks { get; set; } } Here is what the mapping looks like for this relationship ...

Entity Framework Self Referencing Hierarchical Many To Many

OK this problem has it all. Conceptually I have a Resource entity which can have many Child Resources and many Parent Resources. The Resource table has two fields, ID and Name with ID being the primary key. To complete the many to many relationship I created a ResourceHierarchy table which has two fields, (Parent_ID, Child_ID) and two ...

Need index with sys_connect_by_path function? How to emulate it?

Hi, I have a self referencing table in Oracle 9i, and a view that gets data from it: CREATE OR REPLACE VIEW config AS SELECT c.node_id, c.parent_node_id, c.config_key, c.config_value, (SELECT c2.config_key FROM vera.config_tab c2 WHERE c2.node_id = c.parent_node_id) AS parent_config_key,...

Self-reference entity in Hibernate

Hi guys, I have an Action entity, that can have other Action objects as child in a bidirectional one-to-many relationship. The problem is that Hibernate outputs the following exception: "Repeated column in mapping for collection: DbAction.childs column: actionId" Below the code of the mapping: <?xml version="1.0"?> <!DOCTYPE hiberna...

class __init__ (not instance __init__)

Here's a very simple example of what I'm trying to get around: class Test(object): some_dict = {Test: True} The problem is that I cannot refer to Test while it's still being defined Normally, I'd just do this: class Test(object): some_dict = {} def __init__(self): if self.__class__.some_dict == {}: se...

MS EF4: How to decipher a self referencing table?

I have a Product table with fields like: public class Product { public int ID {get;set;} ... } and a table that joins Products to other "cross sell" products (like items): public class CrossSell { public int ProductID {get;set;} public int CrossSellID {get;set;} } My intent is, given any product, get a list of cross...

Different ways to reference yourself?

The handle to yourself is called different things in OOP languages. The few I've come across so far: this (e.g. Java, C#) Me (e.g. VB, vba) self (e.g. Python) Anyone know any others? ...

Using polymorph many-to-many self referencing relation with attributes on the relation in rails

Hi, I'd like to create a self referencing relation in rails. I have a Person model, and the person should have masters and pupils with same Person object. So far I tried: class Person <ActiveRecord::Base has_many :relationships, :dependent => :destroy has_many :masters, :through => :relationships, :conditions => "status='master'"...

Uses of self referencing lists

Hello, I know it is possible to create a self referencing list in languages like Python: >>> my_list = [1,2] >>> my_list.append(my_list) >>> print my_list [1,2,[...]] >>> print my_list[0] 1 >>> print my_list[2] [1,2,[...]] What algorithms benefit from self referencing lists? I cannot think of one. Thanks. ...

Entity Framework Self-Referencial Many-To-Many with Payload ( Bill of Materials BOM )

I asked this question a while back without an answer, I believe it may be the most bizarre implementation for the EF, although it is quite practical. Here is my previous post: http://stackoverflow.com/questions/2367702/entity-framework-self-referencing-hierarchical-many-to-many I've decided to ask again with the additional keyword Payl...

LINQ to Entity problem. Self-referencing entity.

Hello! I have a Self-referencing entity (0 to *). When i tried to delete one, got an error. The structure of data is: servise1 --service 1.1 --service 1.2 ---service 1.2.1 ---service 1.2.2 ---service 1.2.3 --service 1.3 --service 1.4 service 2 and so on... I just need to delete one of the services with all subservices (cascade). Ple...