CompileAssemblyFromDom with many-to-may relation

215 Views Asked by At

I have two classes.

public class Student{
    public List<Course> Courses {get;set;}      
}   
public class Course{
    public Student Student {get;set;}
}   

I need to compile them each in separate assembly. CompileAssemblyFromDom argues that it doesnt find another type and it makes sense because these classes are circular dependent. Is there any workaround to do that?

Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

You cannot have them in separate assemblies; you can however abstract out interfaces for the classes and share the interfaces.

In order to reference one assembly from the other when using CompileAssemblyFromDom, you should use the CompilerParameters.ReferencedAssemblies Property