コード例 #1
0
        public virtual AssetTypeFileExtension Update(AssetTypeFileExtension assetTypeFileExtension)
        {
            if (!assetTypeFileExtension.IsDirty || assetTypeFileExtension.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(assetTypeFileExtension);
            }

            IDbCommand command = CreateCommand();

            if (assetTypeFileExtension.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AssetTypeFileExtension] ([Extension], [Name], [AssetTypeId], [IconImage], [IconFilename], [IsVisible], [Plugin]) VALUES (@extension, @name, @assetTypeId, @iconImage, @iconFilename, @isVisible, @plugin) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AssetTypeFileExtension] SET [Extension] = @extension, [Name] = @name, [AssetTypeId] = @assetTypeId, [IconImage] = @iconImage, [IconFilename] = @iconFilename, [IsVisible] = @isVisible, [Plugin] = @plugin WHERE AssetTypeFileExtensionId = @assetTypeFileExtensionId";
            }

            // HACK: Need to deal with this generated code in a better way
            IDbDataParameter param = CreateParameter("@iconImage", assetTypeFileExtension.IconImage);

            param.DbType = DbType.Binary;
            command.Parameters.Add(param);

            command.Parameters.Add(CreateParameter("@extension", assetTypeFileExtension.Extension));
            command.Parameters.Add(CreateParameter("@name", assetTypeFileExtension.Name));
            command.Parameters.Add(CreateParameter("@assetTypeId", assetTypeFileExtension.AssetTypeId));
            command.Parameters.Add(CreateParameter("@iconFilename", assetTypeFileExtension.IconFilename));
            command.Parameters.Add(CreateParameter("@isVisible", assetTypeFileExtension.IsVisible));
            command.Parameters.Add(CreateParameter("@plugin", assetTypeFileExtension.Plugin));

            if (assetTypeFileExtension.IsNew)
            {
                assetTypeFileExtension.AssetTypeFileExtensionId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@assetTypeFileExtensionId", assetTypeFileExtension.AssetTypeFileExtensionId));
                ExecuteCommand(command);
            }

            assetTypeFileExtension.IsDirty = false;
            assetTypeFileExtension.ChangedProperties.Clear();

            return(assetTypeFileExtension);
        }
コード例 #2
0
        protected override object ReadRow(IRowReader reader)
        {
            AssetTypeFileExtension assetTypeFileExtension = AssetTypeFileExtension.New();

            // Table Fields
            assetTypeFileExtension.AssetTypeFileExtensionId = reader.GetInt32("AssetTypeFileExtensionId");
            assetTypeFileExtension.Extension    = reader.GetString("Extension");
            assetTypeFileExtension.Name         = reader.GetString("Name");
            assetTypeFileExtension.AssetTypeId  = reader.GetInt32("AssetTypeId");
            assetTypeFileExtension.IconImage    = reader.GetBytes("IconImage");
            assetTypeFileExtension.IconFilename = reader.GetString("IconFilename");
            assetTypeFileExtension.IsVisible    = reader.GetBoolean("IsVisible");
            assetTypeFileExtension.Plugin       = reader.GetGuid("Plugin");

            // View Fields
            assetTypeFileExtension.AssetTypeName = reader.GetString("AssetTypeName");

            assetTypeFileExtension.IsDirty = false;
            assetTypeFileExtension.ChangedProperties.Clear();

            return(assetTypeFileExtension);
        }
コード例 #3
0
 public static AssetTypeFileExtension Update(AssetTypeFileExtension assetTypeFileExtension)
 {
     return(AssetTypeFileExtensionMapper.Instance.Update(assetTypeFileExtension));
 }
コード例 #4
0
        public static AssetTypeFileExtension FindOne(AssetTypeFileExtensionFinder finder)
        {
            AssetTypeFileExtension AssetTypeFileExtension = AssetTypeFileExtensionMapper.Instance.FindOne(finder);

            return(AssetTypeFileExtension ?? Empty);
        }
コード例 #5
0
        public static AssetTypeFileExtension Get(Nullable <Int32> AssetTypeFileExtensionId)
        {
            AssetTypeFileExtension AssetTypeFileExtension = AssetTypeFileExtensionMapper.Instance.Get(AssetTypeFileExtensionId);

            return(AssetTypeFileExtension ?? Empty);
        }