public override void Load() { base.Load(); var bundleId = ExtensionBundleHelper.GetExtensionBundleOptions(_hostOptions).Id; if (!string.IsNullOrEmpty(bundleId)) { var packages = ExtensionsHelper.GetExtensionPackages(); if (packages.Count() == 0) { var keysToRemove = Data.Where((keyValue) => keyValue.Key.Contains("extensionBundle")) .Select(keyValue => keyValue.Key) .ToList(); foreach (var key in keysToRemove) { Data.Remove(key); } } else { Data["AzureFunctionsJobHost:extensionBundle:downloadPath"] = Path.Combine(Path.GetTempPath(), "Functions", ScriptConstants.ExtensionBundleDirectory, bundleId); } } }
public async override Task RunAsync() { if (CommandChecker.CommandExists("dotnet")) { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(); var args = $"add {extensionsProj} package {Package} --version {Version}"; if (!string.IsNullOrEmpty(Source)) { args += $" --source {Source}"; } var addPackage = new Executable("dotnet", args); await addPackage.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); var syncAction = new SyncExtensionsAction() { OutputPath = OutputPath }; await syncAction.RunAsync(); } else { ColoredConsole.Error.WriteLine(ErrorColor("Extensions command require dotnet on your path. Please make sure to install dotnet for your system from https://www.microsoft.com/net/download")); } }
public async override Task RunAsync() { var extensionBundleManager = ExtensionBundleHelper.GetExtensionBundleManager(); if (extensionBundleManager.IsExtensionBundleConfigured()) { var hostFilePath = Path.Combine(Environment.CurrentDirectory, ScriptConstants.HostMetadataFileName); if (_showExtensionBundleWarning) { ColoredConsole.WriteLine(WarningColor($"No action performed. Extension bundle is configured in {hostFilePath}")); } return; } if (CommandChecker.CommandExists("dotnet")) { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(_secretsManager, Csx, ConfigPath); var installExtensions = new Executable("dotnet", $"build \"{extensionsProj}\" -o \"{OutputPath}\""); await installExtensions.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); } else { ColoredConsole.Error.WriteLine(ErrorColor(Constants.Errors.ExtensionsNeedDotnet)); } }
public async override Task RunAsync() { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(); var installExtensions = new Executable("dotnet", $"build {extensionsProj} -o {OutputPath}"); await installExtensions.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); }
CodeTypeReference GenerateServiceContractTypeInternal(ContractDescription contractDescription) { if (contractDescription == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("contractDescription"); } Type existingType; if (referencedTypes.TryGetValue(contractDescription, out existingType)) { return(GetCodeTypeReference(existingType)); } ServiceContractGenerationContext context; CodeNamespace ns = this.NamespaceManager.EnsureNamespace(contractDescription.Namespace); if (!generatedTypes.TryGetValue(contractDescription, out context)) { context = new ContextInitializer(this, new CodeTypeFactory(this, options.IsSet(ServiceContractGenerationOptions.InternalTypes))).CreateContext(contractDescription); ExtensionsHelper.CallContractExtensions(GetBeforeExtensionsBuiltInContractGenerators(), context); ExtensionsHelper.CallOperationExtensions(GetBeforeExtensionsBuiltInOperationGenerators(), context); ExtensionsHelper.CallBehaviorExtensions(context); ExtensionsHelper.CallContractExtensions(GetAfterExtensionsBuiltInContractGenerators(), context); ExtensionsHelper.CallOperationExtensions(GetAfterExtensionsBuiltInOperationGenerators(), context); generatedTypes.Add(contractDescription, context); } return(context.ContractTypeReference); }
/// <summary> /// Handles the CollectionChanged event of the collection control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.Xpo.XPCollectionChangedEventArgs"/> instance containing the event data.</param> private void collection_CollectionChanged(object sender, XPCollectionChangedEventArgs e) { if (TrackedObjectBag.SessionData.Collector.ProtocolService.LoadService.IsLoading) { return; } ProtocolEventType protocolEventType; switch (e.CollectionChangedType) { case XPCollectionChangedType.AfterAdd: protocolEventType = ProtocolEventType.AddedToCollection; break; case XPCollectionChangedType.AfterRemove: protocolEventType = ProtocolEventType.RemovedFromCollection; break; default: return; } var protEvent = new ProtocolEvent { Target = TargetObject, OldValue = e.ChangedObject, PropertyName = Collections[(XPBaseCollection)sender], ProtocolEventType = protocolEventType, ReplicationKey = ExtensionsHelper.GetReplicationKey(TargetObject) }; var session = ((ISessionProvider)TargetObject).Session; TrackedObjectBag.SessionData.Collector.RegisterProtocolEvent(session, protEvent); }
private bool NeedsExtensionsInstall() { string warningMessage = "No action performed because no functions in your app require extensions."; // CASE 1: If users need a package to be installed if (!string.IsNullOrEmpty(Package) || !string.IsNullOrEmpty(Version)) { return(true); } // CASE 2: If there are any bindings that need to install extensions if (ExtensionsHelper.GetExtensionPackages().Count() > 0) { return(true); } var extensionsProjDir = string.IsNullOrEmpty(ConfigPath) ? Environment.CurrentDirectory : ConfigPath; var extensionsProjFile = Path.Combine(extensionsProjDir, Constants.ExtenstionsCsProjFile); // CASE 3: No extensions.csproj if (!FileSystemHelpers.FileExists(extensionsProjFile)) { if (_showNoActionWarning) { ColoredConsole.WriteLine(WarningColor(warningMessage)); } return(false); } // CASE 4: extensions.csproj present with only ExtensionsMetaDataGenerator in it // We look for this special case because we had added ExtensionsMetaDataGenerator to all function apps. // These apps do not need to do a restore, so if only ExtensionsMetaDataGenerator is present, we don't need to continue var extensionsProject = ProjectHelpers.GetProject(extensionsProjFile); var extensionsInProject = extensionsProject.Items .Where(item => item.ItemType.Equals(Constants.PackageReferenceElementName, StringComparison.OrdinalIgnoreCase)) .ToList(); if (extensionsInProject.Count == 1 && extensionsInProject.FirstOrDefault(item => item.Include.Equals(Constants.ExtensionsMetadataGeneratorPackage.Name, StringComparison.OrdinalIgnoreCase)) != null) { if (_showNoActionWarning) { ColoredConsole.WriteLine(WarningColor(warningMessage)); } if (StaticSettings.IsDebug) { ColoredConsole.WriteLine(VerboseColor($"InstallExtensionAction: No action performed because only {Constants.ExtensionsMetadataGeneratorPackage.Name} reference was found." + $" This extension package does not require and extension install by itself." + $" No other required extensions were found.")); } return(false); } return(true); }
public void WithAServiceCollection_ThenATokenServiceIsAdded() { Mock <IServiceCollection> services = new Mock <IServiceCollection>(); ExtensionsHelper.AddValidationService(services.Object); services.Verify(instance => instance.Add(It.Is <ServiceDescriptor>(x => x.Lifetime == ServiceLifetime.Scoped && x.ServiceType == typeof(IValidatorService))), Times.Once); }
public async override Task RunAsync() { if (CommandChecker.CommandExists("dotnet")) { if (!string.IsNullOrEmpty(ConfigPath) && !FileSystemHelpers.DirectoryExists(ConfigPath)) { throw new CliArgumentsException("Invalid config path, please verify directory exists"); } var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(_secretsManager, Csx, ConfigPath); if (string.IsNullOrEmpty(Package) && string.IsNullOrEmpty(Version)) { var project = ProjectHelpers.GetProject(extensionsProj); foreach (var extensionPackage in ExtensionsHelper.GetExtensionPackages()) { // Only add / update package referece if it does not exist or forced update is enabled if (!ProjectHelpers.PackageReferenceExists(project, extensionPackage.Name) || Force) { await AddPackage(extensionsProj, extensionPackage.Name, extensionPackage.Version); } } } else if (!string.IsNullOrEmpty(Package) && !string.IsNullOrEmpty(Version)) { await AddPackage(extensionsProj, Package, Version); } else { throw new CliArgumentsException("Must specify extension package name and version", new CliArgument { Name = nameof(Package), Description = "Extension package name" }, new CliArgument { Name = nameof(Version), Description = "Extension package version" } ); } var syncAction = new SyncExtensionsAction(_secretsManager) { OutputPath = OutputPath, ConfigPath = ConfigPath }; await syncAction.RunAsync(); } else { ColoredConsole.Error.WriteLine(ErrorColor(Constants.Errors.ExtensionsNeedDotnet)); } }
public async override Task RunAsync() { if (CommandChecker.CommandExists("dotnet")) { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(_secretsManager, Csx, ConfigPath); var installExtensions = new Executable("dotnet", $"build \"{extensionsProj}\" -o \"{OutputPath}\""); await installExtensions.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); } else { ColoredConsole.Error.WriteLine(ErrorColor("Extensions command require dotnet on your path. Please make sure to install dotnet for your system from https://www.microsoft.com/net/download")); } }
public async override Task RunAsync() { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(); var addPackage = new Executable("dotnet", $"add {extensionsProj} package {Package} --version {Version}"); await addPackage.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); var syncAction = new SyncExtensionsAction() { OutputPath = OutputPath }; await syncAction.RunAsync(); }
public async override Task RunAsync() { if (CommandChecker.CommandExists("dotnet")) { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(_secretsManager, Csx, ConfigPath); var installExtensions = new Executable("dotnet", $"build \"{extensionsProj}\" -o \"{OutputPath}\""); await installExtensions.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); } else { ColoredConsole.Error.WriteLine(ErrorColor(Constants.Errors.ExtensionsNeedDotnet)); } }
public string GetContent(HtmlHelper htmlHelper, FrontEndCmsPage model, string id) { string result = string.Empty; SharedContent sharedContent = new SharedContents().GetSharedContent(id, model.LanguageCode, true); if (sharedContent.IsNotNull()) { //include any extra modules, excluding {$Content} and other {$SharedContent-...} to avoid recursion string controllerAction; string[] controllerActionArray; bool isModuleFound; foreach (string sharedContentPart in ExtensionsHelper.GetHtmlCodeParts(sharedContent.HtmlCode)) { isModuleFound = false; foreach (IModuleConnector moduleConnector in ModuleConnectorsHelper.GetModuleConnectors()) { foreach (SelectListItem module in moduleConnector.GetSelectItemList()) { if (!sharedContentPart.StartsWith("{$SharedContent") && sharedContentPart.ToLower() == module.Value.ToLower()) { isModuleFound = true; controllerAction = sharedContentPart.Substring(2, sharedContentPart.Length - 3); controllerActionArray = controllerAction.Split('-'); result += moduleConnector.GetContent(htmlHelper, model, controllerActionArray[1]); } } } if (!isModuleFound) { if (sharedContentPart != "{$Content}" && !sharedContentPart.StartsWith("{$SharedContent") && sharedContentPart.StartsWith("{$") && sharedContentPart.EndsWith("}") && sharedContentPart.Contains('-')) { controllerAction = sharedContentPart.Substring(2, sharedContentPart.Length - 3); controllerActionArray = controllerAction.Split('-'); result += htmlHelper.Action(controllerActionArray[1], "FrontEnd" + controllerActionArray[0], model).ToString(); } else { result += sharedContentPart; } } } } return(result); }
/// <summary> /// Finds the application object by replication key. /// </summary> /// <param name="classType">Type of the class.</param> /// <param name="reference">The reference.</param> /// <param name="objectSpace">The object space.</param> /// <returns>Application object</returns> private static object findApplicationObjectByReplicationKey(Type classType, IObjectReference reference, IObjectSpace objectSpace) { object result = null; var modelClass = XafDeltaModule.XafApp.FindModelClass(classType); if (modelClass != null && reference.ReplicationKey != null) { var replicationKeyMember = ExtensionsHelper.GetReplicationKeyMember(modelClass.TypeInfo); var replicationKeyIsCaseInsensitive = modelClass.ReplicationKeyIsCaseInsensitive(); var replicationKeyIsSpaceInsensitive = modelClass.ReplicationKeyIsSpaceInsensitive(); if (replicationKeyMember != null) { CriteriaOperator opLeft = new OperandProperty(replicationKeyMember.Name); CriteriaOperator opRight = new OperandValue(reference.ReplicationKey); if (replicationKeyIsCaseInsensitive) { opLeft = new FunctionOperator(FunctionOperatorType.Upper, opLeft); opRight = new FunctionOperator(FunctionOperatorType.Upper, opRight); } if (replicationKeyIsSpaceInsensitive) { opLeft = new FunctionOperator(FunctionOperatorType.Replace, opLeft, new OperandValue(" "), new OperandValue(String.Empty)); opRight = new FunctionOperator(FunctionOperatorType.Replace, opRight, new OperandValue(" "), new OperandValue(String.Empty)); } var keyCriteria = new BinaryOperator(opLeft, opRight, BinaryOperatorType.Equal); if (replicationKeyMember.MemberInfo.IsAliased) { var list = objectSpace.CreateCollection(modelClass.TypeInfo.Type); result = (from c in list.Cast <object>() let objKeyValue = replicationKeyMember.MemberInfo.GetValue(c) where keysMatches(objKeyValue, reference.ReplicationKey, replicationKeyIsCaseInsensitive, replicationKeyIsSpaceInsensitive) select c).FirstOrDefault(); } else { result = objectSpace.FindObject(classType, keyCriteria, true); } } } return(result); }
public async Task <IHttpActionResult> GetByRow(string language, int fromRow, int toRow) { var langId = ExtensionsHelper.GetLanguageId(language); if (langId == null) { return(BadRequest("Your request language is not exist!")); } var categories = await AdoManager.DataAccessObject.GetFromAsync($"udft_Categories({langId})", true); categories = categories.GetFromToRow(fromRow, toRow); return(Ok(categories)); }
public LOSSpinEditExtension SpinEditFor <TValueType>(Expression <Func <ModelType, TValueType> > expression, Action <LOSSpinEditSettings> method) { HttpUtils.SetContextValue <HtmlHelper>("DXHtmlHelper", HtmlHelper); var settingInstance = new LOSSpinEditSettings { Name = ExtensionsHelper.GetFullHtmlFieldName(expression) }; method?.Invoke(settingInstance); var modelMetadata = ModelMetadata.FromLambdaExpression(expression, HtmlHelper.ViewData); var spinEditComponent = new LOSSpinEditExtension(settingInstance, HtmlHelper.ViewContext, modelMetadata); //spinEditComponent.DoAnythingAfterApplySettings(); return(spinEditComponent); }
public async override Task RunAsync() { if (CommandChecker.CommandExists("dotnet")) { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(); var runtimeId = GetRuntimeIdentifierParameter(); var installExtensions = new Executable("dotnet", $"build {extensionsProj} -o {OutputPath} {runtimeId}"); await installExtensions.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); } else { ColoredConsole.Error.WriteLine(ErrorColor("Extensions command require dotnet on your path. Please make sure to install dotnet for your system from https://www.microsoft.com/net/download")); } }
public async Task <IHttpActionResult> GetByCategory(string language, string category) { var langId = ExtensionsHelper.GetLanguageId(language); if (langId == null) { return(BadRequest("Your request language is not exist!")); } var products = await AdoManager.DataAccessObject.GetFromQueryAsync($"Select * from udfv_PortfoliosView({langId}) where Categories like '%{category}%'", true); var portfolios = await ConvertToPortfoliosAsync(products); return(Ok(portfolios)); }
public async Task <IHttpActionResult> Get(string language) { var langId = ExtensionsHelper.GetLanguageId(language); if (langId == null) { return(BadRequest("Your request language is not exist!")); } var products = await AdoManager.DataAccessObject.GetFromAsync($"udfv_PortfoliosView({langId})", true); var portfolios = await ConvertToPortfoliosAsync(products); return(Ok(portfolios)); }
public async override Task RunAsync() { if (CommandChecker.CommandExists("dotnet")) { if (!string.IsNullOrEmpty(ConfigPath) && !FileSystemHelpers.DirectoryExists(ConfigPath)) { throw new CliArgumentsException("Invalid config path, please verify directory exists"); } var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(_secretsManager, Csx, ConfigPath); if (string.IsNullOrEmpty(Package) && string.IsNullOrEmpty(Version)) { foreach (var extensionPackage in ExtensionsHelper.GetExtensionPackages()) { await AddPackage(extensionsProj, extensionPackage.Name, extensionPackage.Version); } } else if (!string.IsNullOrEmpty(Package) && !string.IsNullOrEmpty(Version)) { await AddPackage(extensionsProj, Package, Version); } else { throw new CliArgumentsException("Must specify extension package name and version", new CliArgument { Name = nameof(Package), Description = "Extension package name" }, new CliArgument { Name = nameof(Version), Description = "Extension package version" } ); } var syncAction = new SyncExtensionsAction(_secretsManager) { OutputPath = OutputPath, ConfigPath = ConfigPath }; await syncAction.RunAsync(); } else { ColoredConsole.Error.WriteLine(ErrorColor("Extensions command require dotnet on your path. Please make sure to install dotnet for your system from https://www.microsoft.com/net/download")); } }
public void Setup() { List <ServiceDescriptor> descriptors = new List <ServiceDescriptor>(); services = new Mock <IServiceCollection>(); services .Setup(instance => instance.GetEnumerator()) .Returns(descriptors.GetEnumerator()); configuration = new JwtConfiguration { Audience = "some audience", Expiry = TimeSpan.FromDays(1), Issuer = "some issuer" }; ExtensionsHelper.AddJwt(services.Object, configuration); }
private void registerDcManyToManyChange(object linkObject, XPMemberInfo propMember, object element, ProtocolEventType protocolEventType, bool recurse) { var oppositeProp = (from p in propMember.Owner.ObjectProperties.Cast <XPMemberInfo>() where p.Name.EndsWith(SpecificWords.LinkedPostfix) && p != propMember select p).FirstOrDefault(); if (oppositeProp != null) { var targetObject = oppositeProp.GetValue(linkObject); if (targetObject != null) { var targetModelClass = XafDeltaModule.XafApp.FindModelClass(targetObject.GetType()); if (targetModelClass != null) { var nameArray = propMember.Name.Split('_').ToList(); if (nameArray.Count > 2) { nameArray.RemoveAt(0); nameArray.RemoveAt(nameArray.Count - 1); var targetListName = string.Join("_", nameArray.ToArray()); var protEvent = new ProtocolEvent { Target = targetObject, OldValue = element, PropertyName = targetListName, ProtocolEventType = protocolEventType, ReplicationKey = ExtensionsHelper.GetReplicationKey(targetObject) }; var session = ((ISessionProvider)targetObject).Session; Collector.RegisterProtocolEvent(session, protEvent); if (!recurse) { registerDcManyToManyChange(linkObject, oppositeProp, targetObject, protocolEventType, true); } } } } } }
public void PopulateFeature(IEnumerable <ApplicationPart> parts, ControllerFeature feature) { _ = feature ?? throw new ArgumentNullException(nameof(feature)); var appParts = parts?.OfType <IApplicationPartTypeProvider>() ?? throw new ArgumentNullException(nameof(parts)); // inspect all but those parts coming from CoreXF.Framework (fails with an ReflectionTypeLoadException) foreach (var part in appParts.Where(x => (x as ApplicationPart)?.Name != Assembly.GetAssembly(typeof(Registry.ExtensionsLoader)).GetName().Name)) { foreach (var type in part.Types.Where(t => ExtensionsHelper.IsController(t) && feature.Controllers.Contains(t) == false)) { if (ExtensionsHelper.IsExtension(type.Assembly, this.logger)) { // should be one or more, First/OrDefault() doesn't work instead var extensionAttribute = type.GetCustomAttributes().SingleOrDefault(a => a is ExportAttribute); if (extensionAttribute != null) { var area = type.Assembly.GetName().Name; if (this.Areas.ContainsKey(area) == false) { this.Areas.Add(area, new List <TypeInfo>()); } this.Areas[area].Add(type); feature.Controllers.Add(type); this.registry.GetExtension(((AssemblyPart)part).Assembly).AddController(type); this.logger.LogInformation($"Controller '{type.AsType().FullName}' has been registered and is accessible."); } else { this.logger.LogWarning($"Controller '{type.AsType().FullName}' is inaccessible. Decorate it with '{nameof(ExportAttribute)}' if you want to access it."); } } else { feature.Controllers.Add(type); } } } }
/// <summary> /// Handles the ObjectDeleted event of the session control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.Xpo.ObjectManipulationEventArgs"/> instance containing the event data.</param> private void session_ObjectDeleted(object sender, ObjectManipulationEventArgs e) { if (isMaintenanceObject(e.Object)) { return; } if (!isDcManyToManyLinkObject(e.Object)) { RegisterProtocolEvent(new ProtocolEvent { Target = e.Object, ProtocolEventType = ProtocolEventType.ObjectDeleted, ReplicationKey = ExtensionsHelper.GetReplicationKey(e.Object) }); } trackedObjects.Remove(e.Object); }
public void PopulateFeature(IEnumerable <ApplicationPart> parts, TagHelperFeature feature) { if (feature == null) { throw new ArgumentNullException(nameof(feature)); } var appParts = parts?.OfType <IApplicationPartTypeProvider>() ?? throw new ArgumentNullException(nameof(parts)); foreach (var part in appParts) { var types = part.Types.Where(t => /*ExtensionsHelper.IsController(t) && */ feature.TagHelpers.Contains(t) == false); foreach (var type in types) { if (ExtensionsHelper.IsExtension(type.Assembly, this.logger)) { // should be one or more, First/OrDefault() doesn't work instead var extensionAttribute = type.GetCustomAttributes().SingleOrDefault(a => a is ExportAttribute); if (extensionAttribute != null) { var area = type.Assembly.GetName().Name; if (this.Areas.ContainsKey(area) == false) { this.Areas.Add(area, new List <TypeInfo>()); } this.Areas[area].Add(type); feature.TagHelpers.Add(type); this.logger.LogInformation($"Tag Helper '{type.AsType().FullName}' has been registered and is accessible."); } else { this.logger.LogWarning($"Tag Helper '{type.AsType().FullName}' is inaccessible. Decorate it with '{nameof(ExportAttribute)}' if you want to access it."); } } else { feature.TagHelpers.Add(type); } } } }
/// <summary> /// Gets the replication key old value. /// </summary> /// <param name="source">The source.</param> /// <returns>Replication key old value</returns> public string GetReplicationKeyOldValue(object source) { string result = null; var replKeyMember = ExtensionsHelper.GetReplicationKeyMember(source); if (replKeyMember != null) { var oldValues = GetOldValues(source); if (oldValues != null) { object keyValue; oldValues.TryGetValue(replKeyMember.Name, out keyValue); if (keyValue != null) { result = keyValue.ToString(); } } } return(result); }
/// <summary> /// Store object data in reference. /// </summary> /// <param name="source">The source.</param> public virtual void Assign(object source) { if (source == null) { AssemblyName = ""; ClassName = ""; ObjectId = ""; AssemblyQualifiedName = ""; ReplicationKey = ""; } else { var modelClass = XafDeltaModule.XafApp.FindModelClass(source.GetType()); AssemblyName = modelClass.TypeInfo.AssemblyInfo.Assembly.GetName().Name; ClassName = modelClass.TypeInfo.FullName; ObjectId = XPWeakReference.KeyToString(modelClass.TypeInfo.KeyMember.GetValue(source)); AssemblyQualifiedName = modelClass.TypeInfo.Type.AssemblyQualifiedName; ReplicationKey = ExtensionsHelper.GetReplicationKey(source); } }
public async override Task RunAsync() { var extensionsProj = await ExtensionsHelper.EnsureExtensionsProjectExistsAsync(); var args = $"add {extensionsProj} package {Package} --version {Version}"; if (!string.IsNullOrEmpty(Source)) { args += $" --source {Source}"; } var addPackage = new Executable("dotnet", args); await addPackage.RunAsync(output => ColoredConsole.WriteLine(output), error => ColoredConsole.WriteLine(ErrorColor(error))); var syncAction = new SyncExtensionsAction() { OutputPath = OutputPath }; await syncAction.RunAsync(); }
public DropDownListEditExtension DropDownEditFor <TValueType>(Expression <Func <ModelType, TValueType> > expression, Action <DropDownListEditSettings> settings) { HttpUtils.SetContextValue <HtmlHelper>("DXHtmlHelper", HtmlHelper); var settingsInstance = new DropDownListEditSettings(); settings?.Invoke(settingsInstance); settingsInstance.HiddenPropertyName = ExtensionsHelper.GetFullHtmlFieldName(expression); if (string.IsNullOrEmpty(settingsInstance.Name)) { throw new Exception("Name of control must be not empty."); } if (string.IsNullOrEmpty(settingsInstance.HiddenPropertyName)) { throw new Exception("Name of hidden property must be not empty."); } HtmlHelper.ViewContext.Writer.Write(HtmlHelper.HiddenFor(expression).ToHtmlString()); var dropDownEdit = new DropDownListEditExtension(settingsInstance); return(dropDownEdit); }
public async Task <IHttpActionResult> Get(string language) { try { var langId = ExtensionsHelper.GetLanguageId(language); if (langId == null) { return(BadRequest("Your request language is not exist!")); } var results = await DataAccessObject.GetFromAsync($"udft_Categories({langId})", true); return(Ok(results)); } catch (Exception ex) { await ex.RaiseErrorAsync("Xomorod.API"); return(BadRequest(ex.Message)); } }