This commit is contained in:
Stephan
2018-03-07 09:34:23 +01:00
parent 2a3f284554
commit e2ea849211
2 changed files with 7 additions and 5 deletions

View File

@@ -38,10 +38,6 @@ namespace Umbraco.Core.Models.Entities
set
{
SetPropertyValueAndDetectChanges(value, ref _id, Ps.Value.IdSelector);
// fixme - this is a problem w/ user 'admin' having ID 'zero'
// in v7 _hasIdentity becomes true soon as an ID is set, which is... weird
// we should NOT have 'admin' have ID 'zero'
_hasIdentity = value != 0;
}
}

View File

@@ -672,10 +672,16 @@ namespace Umbraco.Core
// return o is T t ? t : (T) System.Convert.ChangeType(o, typeof(T));
//}
private static MethodInfo _convertMethod;
private static void Convert(this ILGenerator ilgen, Type type)
{
ilgen.Emit(OpCodes.Ldtoken, type);
ilgen.CallMethod(typeof(Convert).GetMethod("ChangeType", BindingFlags.Public | BindingFlags.Static, null, new[] { typeof(object), typeof(Type)}, null)); // fixme cache
if (_convertMethod == null)
_convertMethod = typeof(Convert).GetMethod("ChangeType", BindingFlags.Public | BindingFlags.Static, null, new[] { typeof(object), typeof(Type) }, null);
ilgen.CallMethod(_convertMethod);
}
// emits adapter code before OpCodes.Ret