This question is locked. New answers and comments are not allowed.
Hi,
Please, i really need your help.
I wonder what is the best way with Telerik ORM to achive my needs.
I need to implement a multitenancy on my database for this i need to create a new table per tenant to extend default table. This should be handled in runtime as well as net strong types. So lets say tenant wants to extend Products table, he sends a new fields to my service, im creating a new dll with new strong clr type, CustomProducts.dll created it inherited from Product persistent type. Then i need to map this object using Fluent functionality of Telerik ORM, i didnt found any other way but creating a new context, and sending a new metadata in constructor. So i need to construct a new FluentMetadataSource instance and override a PrepareMapping() with my new mapping for new type. So to create a new table or work with it using my new clr type and map it, i need to do something like this .
Type newMetaDataType = System.Reflection.Assembly.LoadFrom(name + ".dll").GetTypes().FirstOrDefault(x => x.Name == name);
object newMetaDataInstance = Activator.CreateInstance(newMetaDataType);
var model = (newMetaDataInstance as Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource).GetModel();
using (var context = new FluentModel1Context(model))
{
context.UpdateSchema();
}
So generally i need to store a 2 dlls with clr types and with mapping and load it runtime and use. I read about artifical types and i see that im doing very similar things here. But i didnt found a way artifical types to inherit from persistance type.
My problem is that when im starting to use context here it throws an error, It is only happens when im loading FluentMetadataSource from DLL. How i can fix this problem to map my new type via reflection, or is there any other way to achive my goal. All i need is to create a new strong type and map it in runtime, to create a new table and use it .
Please, i really need your help.
I wonder what is the best way with Telerik ORM to achive my needs.
I need to implement a multitenancy on my database for this i need to create a new table per tenant to extend default table. This should be handled in runtime as well as net strong types. So lets say tenant wants to extend Products table, he sends a new fields to my service, im creating a new dll with new strong clr type, CustomProducts.dll created it inherited from Product persistent type. Then i need to map this object using Fluent functionality of Telerik ORM, i didnt found any other way but creating a new context, and sending a new metadata in constructor. So i need to construct a new FluentMetadataSource instance and override a PrepareMapping() with my new mapping for new type. So to create a new table or work with it using my new clr type and map it, i need to do something like this .
Type newMetaDataType = System.Reflection.Assembly.LoadFrom(name + ".dll").GetTypes().FirstOrDefault(x => x.Name == name);
object newMetaDataInstance = Activator.CreateInstance(newMetaDataType);
var model = (newMetaDataInstance as Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource).GetModel();
using (var context = new FluentModel1Context(model))
{
context.UpdateSchema();
}
So generally i need to store a 2 dlls with clr types and with mapping and load it runtime and use. I read about artifical types and i see that im doing very similar things here. But i didnt found a way artifical types to inherit from persistance type.
My problem is that when im starting to use context here it throws an error, It is only happens when im loading FluentMetadataSource from DLL. How i can fix this problem to map my new type via reflection, or is there any other way to achive my goal. All i need is to create a new strong type and map it in runtime, to create a new table and use it .