public Uri GetEntityApiUri(IPrimaryKey entity) { if (_templates == null) { lock (_lock) { if (_templates == null) { _templates = CompileUrls(); } } } var testedType = GetMatchingType(entity.GetType()); if (testedType == null) { return(null); } return(new UriBuilder(GetUrlBase()) { Path = GetPath(testedType, entity) }.Uri); }
/// <summary> /// Obtains set of properties participating primary key of the entity /// </summary> /// <param name="pk">Entity with primary key</param> /// <returns>Set of properties participating primary key</returns> public static PropertyInfo[] KeyProperties(this IPrimaryKey pk) { var t = pk.GetType().GetProperty(nameof(IPrimaryKey <int> .PrimaryKey), BindingFlags.Public | BindingFlags.Instance); var keyProps = t.GetValue(pk); var extr = FromTuple <LambdaExpression>(keyProps).Select(x => x.AsPropertyExpression()); return(extr.ToArray()); }