/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/OneScript.StandardLibrary/XMLSchema/Objects/XSMinLengthFacet.cs
131 строка
4 KB
EvilBeaver
Замечание Сонара про необязательный параметр
26 окт 2023, 11:20
26 окт 2023, 11:20
abf8590
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; using System.Diagnostics.Contracts; using System.Xml; using System.Xml.Schema; using OneScript.Contexts; using OneScript.StandardLibrary.XMLSchema.Collections; using OneScript.StandardLibrary.XMLSchema.Enumerations; using OneScript.StandardLibrary.XMLSchema.Interfaces; using ScriptEngine.Machine.Contexts; namespace OneScript.StandardLibrary.XMLSchema.Objects { [ContextClass("ФасетМинимальнойДлиныXS", "XSMinLengthFacet")] public sealed class XSMinLengthFacet : AutoContext<XSMinLengthFacet>, IXSFacet { private readonly XmlSchemaMinLengthFacet _facet; private XSAnnotation _annotation; private XSMinLengthFacet() => _facet = new XmlSchemaMinLengthFacet(); internal XSMinLengthFacet(XmlSchemaMinLengthFacet minLengthFacet) { _facet = minLengthFacet; if (_facet.Annotation is XmlSchemaAnnotation annotation) { _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation); _annotation.BindToContainer(RootContainer, this); } } #region OneScript #region Properties [ContextProperty("Аннотация", "Annotation")] public XSAnnotation Annotation { get => _annotation; set { _annotation = value; _annotation?.BindToContainer(RootContainer, this); XSAnnotation.SetComponentAnnotation(_annotation, _facet); } } [ContextProperty("Компоненты", "Components")] public XSComponentFixedList Components => XSComponentFixedList.EmptyList(); [ContextProperty("Контейнер", "Container")] public IXSComponent Container => SimpleTypeDefinition; [ContextProperty("КорневойКонтейнер", "RootContainer")] public IXSComponent RootContainer { get; private set; } [ContextProperty("Схема", "Schema")] public XMLSchema Schema => RootContainer.Schema; [ContextProperty("ТипКомпоненты", "ComponentType")] public XSComponentType ComponentType => XSComponentType.MinLengthFacet; [ContextProperty("ЛексическоеЗначение", "LexicalValue")] public string LexicalValue { get => _facet.Value; set => _facet.Value = value; } [ContextProperty("ОпределениеПростогоТипа", "SimpleTypeDefinition")] public XSSimpleTypeDefinition SimpleTypeDefinition { get; private set; } [ContextProperty("Фиксированный", "Fixed")] public bool Fixed { get => _facet.IsFixed; set => _facet.IsFixed = value; } [ContextProperty("Значение", "Value")] public decimal Value { get => XmlConvert.ToDecimal(_facet.Value); set => _facet.Value = XmlConvert.ToString(value); } #endregion #region Methods [ContextMethod("КлонироватьКомпоненту", "CloneComponent")] public IXSComponent CloneComponent(bool recursive = true) => throw new NotImplementedException(); [ContextMethod("ОбновитьЭлементDOM", "UpdateDOMElement")] public void UpdateDOMElement() => throw new NotImplementedException(); [ContextMethod("Содержит", "Contains")] public bool Contains(IXSComponent component) => false; #endregion #region Constructors [ScriptConstructor(Name = "По умолчанию")] public static XSMinLengthFacet Constructor() => new XSMinLengthFacet(); #endregion #endregion #region IXSComponent XmlSchemaObject IXSComponent.SchemaObject => _facet; void IXSComponent.BindToContainer(IXSComponent rootContainer, IXSComponent container) { Contract.Requires(container is XSSimpleTypeDefinition); RootContainer = rootContainer; SimpleTypeDefinition = container as XSSimpleTypeDefinition; } #endregion } }