protected override object ReadRow(IRowReader reader)
        {
            AssetFilePath assetFilePath = AssetFilePath.New();

            // Table Fields
            assetFilePath.AssetFilePathId = reader.GetInt32("AssetFilePathId");
            assetFilePath.Path            = reader.GetString("Path");
            assetFilePath.IsDefault       = reader.GetBoolean("IsDefault");


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

            return(assetFilePath);
        }
        public virtual AssetFilePath Update(AssetFilePath assetFilePath)
        {
            if (!assetFilePath.IsDirty || assetFilePath.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(assetFilePath);
            }

            IDbCommand command = CreateCommand();

            if (assetFilePath.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AssetFilePath] ([Path], [IsDefault]) VALUES (@path, @isDefault) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AssetFilePath] SET [Path] = @path, [IsDefault] = @isDefault WHERE AssetFilePathId = @assetFilePathId";
            }

            command.Parameters.Add(CreateParameter("@path", assetFilePath.Path));
            command.Parameters.Add(CreateParameter("@isDefault", assetFilePath.IsDefault));

            if (assetFilePath.IsNew)
            {
                assetFilePath.AssetFilePathId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@assetFilePathId", assetFilePath.AssetFilePathId));
                ExecuteCommand(command);
            }

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

            return(assetFilePath);
        }
Ejemplo n.º 3
0
 public static AssetFilePath Update(AssetFilePath assetFilePath)
 {
     return(AssetFilePathMapper.Instance.Update(assetFilePath));
 }
Ejemplo n.º 4
0
        public static AssetFilePath FindOne(AssetFilePathFinder finder)
        {
            AssetFilePath AssetFilePath = AssetFilePathMapper.Instance.FindOne(finder);

            return(AssetFilePath ?? Empty);
        }
Ejemplo n.º 5
0
        public static AssetFilePath Get(Nullable <Int32> AssetFilePathId)
        {
            AssetFilePath AssetFilePath = AssetFilePathMapper.Instance.Get(AssetFilePathId);

            return(AssetFilePath ?? Empty);
        }