This is a migrated thread and some comments may be shown as answers.

Issues after implementing interfaces

0 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matt
Top achievements
Rank 1
Matt asked on 23 Dec 2015, 04:03 PM

We had a working data access metadata class that was able to push and pull our class data from a SQL database without any issue. Our classes are set up in such a way that they are associated from bottom to top. This means class D has a reference to an instance of class C, and C to B, and B to A.

 

Previously our classes looked something like this:

 

public class D{
 public C classLink{get; set;}
 public int CiD {get; set;}
}
 
public class C{
 public B classLink{get; set;}
 public int BiD {get; set;}
}

This worked great and in the database the table for D would have a column for CiD which would be the FK to the primary key ID in class C. This is repeated up the chain until we get to class A.

 We recently, however, made the switch over to interfaces with a simple example of what we did as follows:

 

public interface IClassD{
 int CiD {get; set;}
 C classLink {get; set;}
}
 
public interface IClassC{
 int BiD {get; set;}
 B classLink {get; set;}
}

 We then refactored our code to match the  new interface implementation and we rebuilt the database after applying the changes listed here:

http://docs.telerik.com/data-access/developers-guide/code-only-mapping/mapping-clr-types-properties-and-associations/advanced-mapping/fluent-mapping-mapping-clr-advanced-polymorphic-references

The database was rebuilt just fine with no errors. Our problem comes when we try to repopulate the database with data again. Previously before we used interfaces we were able to post a single instance of class A and it would cascade, posting all associated B, C, and D class instance data at the same time. Now, however, the only data that is posted to the database is the data for class A and it never cascades. What would cause this?

 

 

Tags
General Discussions
Asked by
Matt
Top achievements
Rank 1
Share this question
or