문제

I accept that this is frowned upon but if someone can humor me that would be great.

Id like to call data from an orchard module using a sql string. To do this I assume i need to get the table prefix if specified when creating the tenant and also the feature prefix for the module.

So for example.

string tenentPrefix = //Wherever I get it from?
string modulePrefix = //Wherever I get it from?

string sql = string.Format("select * from {0}{1}MyTableName",tenentPrefix, modulePrefix); 
//MyTableName obviously being the name of the model

Your help greatly appreciated.

도움이 되었습니까?

해결책

If you inject ShellSettings, then you can access DataTablePrefix on it. That answers the first part. For the second part, hopefully you know the module name, so it should be easy to translate it into the table name by replacing the dots with underscores. ShellBuilder.CompositionStrategy does it this way:

var extensionDescriptor = feature.Descriptor.Extension;
var extensionName = extensionDescriptor.Id.Replace('.', '_');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top