| | 1 | | using System; |
| | 2 | |
|
| | 3 | | namespace FastMigrations.Runtime |
| | 4 | | { |
| | 5 | | /// <summary> |
| | 6 | | /// All "Migrate_<see cref="MigratableAttribute.Version"/>(JObject data)" methods on object marked with this attribu |
| | 7 | | /// On serialization value from version field will be added to json (schema: "JsonVersion": int). |
| | 8 | | /// </summary> |
| | 9 | | /// <remarks>For unity this attribute inherited from "<see cref="UnityEngine.Scripting.PreserveAttribute"/>" to prev |
| | 10 | | /// <seealso cref="FastMigrationsConverter"/> |
| | 11 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)] |
| | 12 | | public class MigratableAttribute : |
| | 13 | | #if UNITY_2019_4_OR_NEWER |
| | 14 | | UnityEngine.Scripting.PreserveAttribute |
| | 15 | | #else |
| | 16 | | System.Attribute |
| | 17 | | #endif |
| | 18 | | { |
| | 19 | | /// <summary>Number of current version of model</summary> |
| | 20 | | /// <remarks>Starts to call Migrate_() methods from version 1. "Migrate_0()" won't be called</remarks> |
| | 21 | | /// <seealso cref="FastMigrationsConverter"/> |
| | 22 | | public readonly uint Version; |
| | 23 | |
|
| | 24 | | /// <param name="version">Number of current version of model. Starts to call Migrate_() methods from version 1. |
| | 25 | | /// <seealso cref="FastMigrationsConverter"/> |
| 65 | 26 | | public MigratableAttribute(uint version) |
| 65 | 27 | | { |
| 65 | 28 | | Version = version; |
| 65 | 29 | | } |
| | 30 | | } |
| | 31 | | } |