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 XOPField(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

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

            _type = new XOPFieldType(XElement);

            _isPk = reader.ReadAttributeBool("pk", false);

            _isPkAutoGenertaed = reader.ReadAttributeBool("isPkAutoGenertaed", true);

            if (!_isPk && _isPkAutoGenertaed)
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Field {0} is not primary key but isPKAutoGenerated is set to true, it will be ignored.", _name), false);

            _defaultValue = reader.ReadAttributeValue("defaultValue", _type.Type);

            _nullable = reader.ReadAttributeBool("nullable", true);

            _isMapped = reader.ReadAttributeBool("isMapped", true);

            _mappedParamName = reader.ReadAttribute("mappedParamName");

            if (!_isMapped && !string.IsNullOrEmpty(_mappedParamName))
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, string.Format("Field {0} is not mapped but it contains mappedParamName, it will be ignored.", _name), false);

            _isMappedTypeConverted = reader.ReadAttributeBool("isMappedTypeConverted", false);

            _calculator = reader.ReadAttribute("calculator");
        }
        public XWPRelation(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

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

            _isShown = reader.ReadAttributeBool("showChildren", false);

            _serializationName = reader.ReadAttribute("serializationName");
        }
        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 XOPDataSet(XElement XElement)
        {
            XmlLinqElementReader reader = new XmlLinqElementReader(XElement, XOApplication.xmlReaderLog);

            _adapterPath = reader.ReadAttribute("adapterPath");

            _adapterType = reader.ReadAttributeEnum<XOPDataSetAdapterType>("adapterType", XOPDataSetAdapterType.Custom);

            if (string.IsNullOrEmpty(_adapterPath) && _adapterType == XOPDataSetAdapterType.Custom)
            {
                XmlLinqReaderLog.WriteToLog(XOApplication.xmlReaderLog, "Either adapterType or adapterPath should be set for DataSet", true);
            }

            _connectionString = reader.ReadAttribute("connectionString", true);

            _schemeName = reader.ReadAttribute("schemeName");

            _useStdCommands = reader.ReadAttributeBool("useStdCommands", true);

            _tables = reader.GetChildren("Table", new Range(1, -1)).Select(p => new XOPTable(p)).ToArray();

            _relations = reader.GetChildren("Relations", new Range(-1, 1)).Select(p=>new XOPRelations(p)).FirstOrDefault();

        }
        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);
        }