public XWPDataView(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _parentDisplayField = reader.ReadAttribute("parentDisplayField");

            _saveMode = reader.ReadAttributeEnumFlags("saveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _childSaveMode = reader.ReadAttributeEnumFlags("childSaveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _tables = reader.GetChildren("Table", Range.NotBound).Select(p => new XWPTable(this, p)).ToArray();

            _relations = reader.GetChildren("Relations", new Range(0, 1)).Select(p => new XWPRelations(p)).FirstOrDefault();
        }
        public XOPTable(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name", true);

            _source = reader.ReadAttribute("source");

            _sourceUpdate = reader.ReadAttribute("sourceUpdate");

            _schemeName = reader.ReadAttribute("schemeName");

            _autoFill = reader.ReadAttributeBool("autoFill", true);

            _persistFill = reader.ReadAttributeBool("persistFill", true);

            _stdCommandsType = reader.ReadAttributeEnumFlags<XOPTableCommandType>("stdCommandsType", XOPTableCommandType.All, XOPTableCommandType.Default);

            XElement xFields = reader.GetChildren("Fields", new DataAvail.Utils.Range(1)).FirstOrDefault();

            _fields = new XOPFields(xFields);

            XElement xFuncs = reader.GetChildren("Functions", new DataAvail.Utils.Range(0, 1)).FirstOrDefault();

            _functions = new XOPFunctions(xFuncs);

        }
        public XOPFunction(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _name = reader.ReadAttribute("name", true);

            _commandType = reader.ReadAttributeEnumFlags("type", XOPTableCommandType.All, XOPTableCommandType.None);

            _params = reader.GetChildren("Param", new Range(1, -1)).Select(p => new XOPFunctionParam(p)).ToArray();  

            if (!(CommandType == (XOPTableCommandType.Insert | XOPTableCommandType.Update)))
            {
                if (_commandType == XOPTableCommandType.None)
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} is None. Command won't be used in project.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Select))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Select and another command. Command of this type can't be mixed, will be used as Select.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Delete))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Delete and another command. Command of this type can't be mixed, will be used as Delete.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Insert))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Insert and command of type diffrent from Update. Command of this type can't be mixed, will be used as Insert.", _name), false);
                }
                else if (EnumFlags.IsContainMixed(_commandType, XOPTableCommandType.Update))
                {
                    XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Attribute commantType of command {0} mixes Update and command of type diffrent from Insert. Command of this type can't be mixed, will be used as Update.", _name), false);
                }
            }
        }
        public XSPTable(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _tableName = reader.ReadAttribute("name", true);

            _mode = reader.ReadAttributeEnumFlags("mode", XOMode.All, XOMode.All);

            _fields = reader.GetChildren("Field", Range.NotBound).Select(p => new XSPField(p)).ToArray();
        }
        public XSPField(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _fieldName = reader.ReadAttribute("name", true);

            _mode = reader.ReadAttributeEnumFlags("mode", XOMode.All, XOMode.View | XOMode.Edit);

            if (EnumFlags.IsContain(_mode, XOMode.Add | XOMode.Delete))
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, "mode", "Field mode can't be nor Add neither Remove, they will be ignored", false);
        }
        public XWPTable(XWPDataView XWPDataView, XElement XElement)
        {
            _xWPDataView = XWPDataView;

            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _tableName = reader.ReadAttribute("name", true);

            _caption = reader.ReadAttribute("caption");

            _itemCaption = reader.ReadAttribute("itemCaption");

            _separateSerialization = reader.ReadAttributeBool("separateSerialization", true);

            _saveMode = reader.ReadAttributeEnumFlags("saveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _childSaveMode = reader.ReadAttributeEnumFlags("childSaveMode", XWPTableSaveMode.All, XWPTableSaveMode.Default);

            _fields = reader.GetChildren("Fields", new Range(0, 1)).Select(p => new XWPFields(this, p)).FirstOrDefault();
        }
        public XSPApplication(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _mode = reader.ReadAttributeEnumFlags("mode", XOMode.All, XOMode.All);

            if (_mode == XOMode.None)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, XElement, "mode", "Mode for application None, in this case project won't have any functionality.", false);

            _tables = reader.GetChildren("Table", Range.NotBound).Select(p => new XSPTable(p)).ToArray();
        }
        public XWPField(XWPFields XWPFields, XElement XElement)
        {
            _xWPFields = XWPFields;

            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _fieldName = reader.ReadAttribute("name", true);

            _caption = reader.ReadAttribute("caption");

            _readOnly = reader.ReadAttributeBool("readOnly", false);

            _mask = new XWPFieldMask(XElement);

            _controlType = reader.ReadAttribute("controlType");

            _parentDisplayField = reader.ReadAttribute("parentDisplayField");

            _fkInterfaceType = reader.ReadAttributeEnumFlags("fkInterface", XWPFieldFkInterfaceType.All, XWPFieldFkInterfaceType.Default);

            _fkSelectItemMode = reader.ReadAttributeEnumFlags("fkSelectItemMode", XOMode.All, XOMode.View);

            _bindingField = reader.ReadAttribute("bindingProperty");

            _displayType = reader.ReadAttributeEnumFlags("displayType", XWPFieldDisplayType.Anywhere, XWPFieldDisplayType.Anywhere);
        }