Esempio n. 1
0
        /// <summary></summary>
        /// <param name="dataSource"></param>
        /// <param name="name"></param>
        /// <param name="config"></param>
        /// <param name="configurationStamp"></param>
        public PpsDataSetServerDefinition(PpsDataSource dataSource, string name, XElement config, DateTime configurationStamp)
        {
            this.dataSource         = dataSource;
            this.application        = dataSource.GetService <PpsApplication>(true);
            this.lua                = dataSource.GetService <IDELuaEngine>(true).Lua;
            this.name               = name;
            this.configurationStamp = configurationStamp;

            // get inherited list
            this.inheritedFrom = config.GetStrings("inherited", true);

            // get script list
            this.serverScripts = config.GetStrings("serverScripts", true);
            this.clientScripts = config.GetPaths("clientScripts", true);

            // parse data table schema
            foreach (var cur in config.Elements())
            {
                if (cur.Name == xnTable)
                {
                    var tableName = cur.GetAttribute("name", String.Empty);
                    if (String.IsNullOrEmpty(tableName))
                    {
                        throw new DEConfigurationException(cur, "table needs a name.");
                    }

                    // create a table
                    var table = FindTable(tableName);
                    if (table != null)
                    {
                        throw new DEConfigurationException(cur, $"table is not unique ('{tableName}')");
                    }

                    Add(CreateTableDefinition(tableName, cur));
                }
                else if (cur.Name == xnMeta)
                {
                    metaInfo.Add(cur);
                }
                else if (cur.Name == xnAutoTag)
                {
                    Add(new PpsDataSetAutoTagDefinition(this,
                                                        cur.GetAttribute("name", String.Empty),
                                                        cur.GetAttribute("tableName", String.Empty),
                                                        cur.GetAttribute("columnName", String.Empty),
                                                        cur.GetAttribute <PpsDataSetAutoTagMode>("mode", PpsDataSetAutoTagMode.First))
                        );
                }
            }     // foreach c
        }         // ctor
Esempio n. 2
0
 /// <summary></summary>
 /// <param name="dataSource"></param>
 /// <param name="connection"></param>
 public PpsDataTransaction(PpsDataSource dataSource, IPpsConnectionHandle connection)
 {
     this.dataSource = dataSource ?? throw new ArgumentNullException(nameof(dataSource));
     this.connection = connection ?? throw new ArgumentNullException(nameof(connection));
 }         // ctor