Ejemplo n.º 1
0
        /// <summary>
        /// Gets <see cref="ISchemaManagerItem"/> manager design item for <paramref name="item"/>.
        /// </summary>
        /// <param name="item"><see cref="EntitySchemaManager"/> manager item.</param>
        /// <returns><see cref="ISchemaManagerItem"/> manager design item.</returns>
        protected virtual ISchemaManagerItem <EntitySchema> GetDesignItem(ISchemaManagerItem <EntitySchema> item)
        {
            ISchemaManagerItem managerItem;

            try {
                (Guid schemaId, Guid schemaRealUId) = _utils.GetSchemaPackageInfo(item.Name, _packageUId);
                managerItem    = _entitySchemaManager.DesignItem(_userConnection, schemaRealUId);
                managerItem.Id = schemaId;
                var instance = managerItem.Instance as EntitySchema;
                instance.Id = schemaId;
            } catch (NullReferenceException) {
                managerItem = _entitySchemaManager.CreateDesignSchema(_userConnection,
                                                                      item.UId, _packageUId, true);
            }
            return(_entitySchemaManager.FindDesignItem(_userConnection, managerItem.UId) as ISchemaManagerItem <EntitySchema>);
        }