本文整理汇总了C#中App.InitData方法的典型用法代码示例。如果您正苦于以下问题:C# App.InitData方法的具体用法?C# App.InitData怎么用?C# App.InitData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App.InitData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: App
public static IApp App(int appId, PortalSettings ownerPortalSettings)
{
var appStuff = new App(ownerPortalSettings, appId);
var provider = new ValueCollectionProvider(); // use blank provider for now
appStuff.InitData(false, provider);
return appStuff;
}
示例2: ModuleContentBlock
public ModuleContentBlock(ModuleInfo moduleInfo, IEnumerable<KeyValuePair<string, string>> overrideParams = null)
{
if(moduleInfo == null)
throw new Exception("Need valid ModuleInfo / ModuleConfiguration of runtime");
ModuleInfo = moduleInfo;
ParentId = moduleInfo.ModuleID;
ContentBlockId = ParentId;
// url-params
_urlParams = overrideParams ?? DnnWebForms.Helpers.SystemWeb.GetUrlParams();
// Ensure we know what portal the stuff is coming from
// PortalSettings is null, when in search mode
PortalSettings = PortalSettings.Current == null || moduleInfo.OwnerPortalID != moduleInfo.PortalID
? new PortalSettings(moduleInfo.OwnerPortalID)
: PortalSettings.Current;
ZoneId = ZoneHelpers.GetZoneID(moduleInfo.OwnerPortalID) ?? 0; // new
AppId = AppHelpers.GetAppIdFromModule(moduleInfo, ZoneId) ?? 0;// fallback/undefined YET
if (AppId == Settings.DataIsMissingInDb)
{
_dataIsMissing = true;
return;
}
if (AppId != 0)
{
// try to load the app - if possible
App = new App(ZoneId, AppId, PortalSettings);
ContentGroup = App.ContentGroupManager.GetContentGroupForModule(moduleInfo.ModuleID);
if (ContentGroup.DataIsMissing)
{
_dataIsMissing = true;
App = null;
return;
}
// use the content-group template, which already covers stored data + module-level stored settings
Template = ContentGroup.Template;
// set show-status of the template/view picker
var showStatus = moduleInfo.ModuleSettings[Settings.SettingsShowTemplateChooser];
bool show;
if (bool.TryParse((showStatus ?? true).ToString(), out show))
ShowTemplateChooser = show;
// maybe ensure that App.Data is ready
App.InitData(SxcInstance.Environment.Permissions.UserMayEditContent, Data.ConfigurationProvider);
}
}
示例3: PublicQuery
public dynamic PublicQuery([FromUri] string appname, [FromUri] string name)
{
// check zone
var zid = ZoneHelpers.GetZoneID(PortalSettings.PortalId);
if (zid == null)
throw new Exception("zone not found");
// get app from appname
var aid = AppHelpers.GetAppIdFromGuidName(zid.Value, appname, true);
_queryApp = new App(PortalSettings, aid);
// ensure the queries can be executed (needs configuration provider, usually given in SxcInstance, but we don't hav that here)
var config = DataSources.ConfigurationProvider.GetConfigProviderForModule(0, _queryApp, null);
_queryApp.InitData(false, config);
_useModuleAndCheckModulePermissions = false; // disable module level permission check, as there is no module which can give more permissions
// now just run the default query check and serializer
return Query(name);
}
示例4: _constructor
private void _constructor(IContentBlock parent, IEntity cbDefinition)
{
Parent = parent;
ParseContentBlockDefinition(cbDefinition);
ParentId = parent.ParentId;
ContentBlockId = -cbDefinition.EntityId; // "mod:" + ParentId + "-ent:" + cbDefinition.EntityId;
// Ensure we know what portal the stuff is coming from
PortalSettings = Parent.App.OwnerPortalSettings;
ZoneId = Parent.ZoneId;
AppId = AppHelpers.GetAppIdFromGuidName(ZoneId, _appName); // should be 0 if unknown, must test
if (AppId == Settings.DataIsMissingInDb)
{
_dataIsMissing = true;
return;
}
if (AppId != 0)
{
// try to load the app - if possible
App = new App(ZoneId, AppId, PortalSettings);
ContentGroup = App.ContentGroupManager.GetContentGroupOrGeneratePreview(_contentGroupGuid, _previewTemplateGuid);
// handle cases where the content group is missing - usually because of uncomplete import
if (ContentGroup.DataIsMissing)
{
_dataIsMissing = true;
App = null;
return;
}
// use the content-group template, which already covers stored data + module-level stored settings
Template = ContentGroup.Template;
// maybe ensure that App.Data is ready
App.InitData(SxcInstance.Environment.Permissions.UserMayEditContent, Data.ConfigurationProvider);
}
}