Exemplo n.º 1
0
        public MsSqlInventoryService(IConfig ownSection)
        {
            m_InventoryItemTable   = ownSection.GetString("ItemTable", "inventoryitems");
            m_InventoryFolderTable = ownSection.GetString("FolderTable", "inventoryfolders");
            m_ConnectionString     = MsSqlUtilities.BuildConnectionString(ownSection, m_Log);
            m_ContentService       = new DefaultInventoryFolderContentService(this);

            /* renaming of tables for NPCs required so creating those on the fly */
            Migrations = new IMigrationElement[]
            {
                new SqlTable(m_InventoryFolderTable),
                new AddColumn <UUID>("ID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <UUID>("ParentFolderID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <UUID>("OwnerID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <string>("Name")
                {
                    Cardinality = 64, IsNullAllowed = false, Default = string.Empty
                },
                new AddColumn <InventoryType>("InventoryType")
                {
                    IsNullAllowed = false, Default = InventoryType.Unknown
                },
                new AddColumn <int>("Version")
                {
                    IsNullAllowed = false, Default = 0
                },
                new PrimaryKeyInfo("ID"),
                new NamedKeyInfo("inventoryfolders_owner_index", "OwnerID"),
                new NamedKeyInfo("inventoryfolders_owner_folderid", "OwnerID", "ParentFolderID"),
                new NamedKeyInfo("inventoryfolders_owner_type", "OwnerID", "InventoryType"),
                new TableRevision(2),
                new ChangeColumn <AssetType>("DefaultType")
                {
                    IsNullAllowed = false, Default = AssetType.Unknown, OldName = "InventoryType"
                },

                new SqlTable(m_InventoryItemTable),
                new AddColumn <UUID>("ID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <UUID>("ParentFolderID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <string>("Name")
                {
                    Cardinality = 64, IsNullAllowed = false, Default = string.Empty
                },
                new AddColumn <string>("Description")
                {
                    Cardinality = 128, IsNullAllowed = false, Default = string.Empty
                },
                new AddColumn <InventoryType>("InventoryType")
                {
                    IsNullAllowed = false, Default = InventoryType.Unknown
                },
                new AddColumn <InventoryFlags>("Flags")
                {
                    IsNullAllowed = false, Default = InventoryFlags.None
                },
                new AddColumn <UUID>("OwnerID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <UUID>("LastOwnerID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <UUID>("CreatorID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <Date>("CreationDate")
                {
                    IsNullAllowed = false, Default = Date.UnixTimeToDateTime(0)
                },
                new AddColumn <InventoryPermissionsMask>("BasePermissionsMask")
                {
                    IsNullAllowed = false, Default = InventoryPermissionsMask.None
                },
                new AddColumn <InventoryPermissionsMask>("CurrentPermissionsMask")
                {
                    IsNullAllowed = false, Default = InventoryPermissionsMask.None
                },
                new AddColumn <InventoryPermissionsMask>("EveryOnePermissionsMask")
                {
                    IsNullAllowed = false, Default = InventoryPermissionsMask.None
                },
                new AddColumn <InventoryPermissionsMask>("NextOwnerPermissionsMask")
                {
                    IsNullAllowed = false, Default = InventoryPermissionsMask.None
                },
                new AddColumn <InventoryPermissionsMask>("GroupPermissionsMask")
                {
                    IsNullAllowed = false, Default = InventoryPermissionsMask.None
                },
                new AddColumn <int>("SalePrice")
                {
                    IsNullAllowed = false, Default = 10
                },
                new AddColumn <InventoryItem.SaleInfoData.SaleType>("SaleType")
                {
                    IsNullAllowed = false, Default = InventoryItem.SaleInfoData.SaleType.NoSale
                },
                new AddColumn <InventoryPermissionsMask>("SalePermissionsMask")
                {
                    IsNullAllowed = false, Default = InventoryPermissionsMask.None
                },
                new AddColumn <UUID>("GroupID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <bool>("IsGroupOwned")
                {
                    IsNullAllowed = false, Default = false
                },
                new AddColumn <UUID>("AssetID")
                {
                    IsNullAllowed = false, Default = UUID.Zero
                },
                new AddColumn <AssetType>("AssetType")
                {
                    IsNullAllowed = false, Default = AssetType.Unknown
                },
                new PrimaryKeyInfo("ID"),
                new NamedKeyInfo("inventoryitems_OwnerID", "OwnerID"),
                new NamedKeyInfo("inventoryitems_OwnerID_ID", "OwnerID", "ID"),
                new NamedKeyInfo("inventoryitems_OwnerID_ParentFolderID", "OwnerID", "ParentFolderID"),
                new TableRevision(2),
                /* necessary boolean correction */
                new ChangeColumn <bool>("IsGroupOwned")
                {
                    IsNullAllowed = false, Default = false
                },
            };
        }
 public MemoryInventoryService()
 {
     m_ContentService = new DefaultInventoryFolderContentService(this);
 }