Exemplo n.º 1
0
 /// <summary>
 /// Look up a type in the EntityFramework based on the type identifier.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="edmx"></param>
 /// <param name="identifier"></param>
 /// <returns></returns>
 public static T ResourceWithIdentifier <T>(this EntityFramework edmx, string identifier) where T : class
 {
     return(edmx.DataServices.Schemas.ResourceWithIdentifier <T>(identifier));
 }
Exemplo n.º 2
0
 public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx, IssueLogger issues)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 3
0
 public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx, IssueLogger issues)
 {
     return(edmx.ResourceWithIdentifier <IODataNavigable>(this.TypeIdentifier));
 }
Exemplo n.º 4
0
 public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx, IssueLogger issues, bool isLastSegment)
 {
     throw new NotSupportedException($"simple type can't navigate to {component}");
 }
Exemplo n.º 5
0
        public static IODataNavigable NavigateByFunction(this IODataNavigable source, string component, EntityFramework edmx, bool isLastSegment)
        {
            var matches =
                edmx.DataServices.Schemas.SelectMany(s => s.Functions).
                Where(f =>
                      f.IsBound &&
                      (f.Name == component || f.ParameterizedName == component) &&
                      f.ReturnType?.Type != null &&
                      f.Parameters.Any(p => p.Name == "bindingParameter" && p.Type.TypeOnly() == source.TypeIdentifier.TypeOnly())).
                ToList();

            if (matches.Any())
            {
                foreach (var m in matches)
                {
                    m.IsComposable = true;
                }

                var match = matches.First().ReturnType.Type;
                return(edmx.ResourceWithIdentifier <IODataNavigable>(match));
            }

            var otherCaseName =
                edmx.DataServices.Schemas.SelectMany(s => s.Functions).
                Where(f =>
                      f.IsBound &&
                      (f.Name.IEquals(component) || f.ParameterizedName.IEquals(component)) &&
                      f.Parameters.Any(p => p.Name == "bindingParameter" && p.Type.TypeOnly() == source.TypeIdentifier.TypeOnly())).
                Select(f => f.Name.IEquals(component) ? f.Name : f.ParameterizedName).
                FirstOrDefault();

            if (otherCaseName != null)
            {
                throw new ArgumentException($"ERROR: case mismatch between URL segment '{component}' and schema element '{otherCaseName}'");
            }

            return(null);
        }
Exemplo n.º 6
0
 public override void ApplyTransformation(BaseModifications value, EntityFramework edmx, string[] versions)
 {
     base.ApplyTransformation(value, edmx, versions);
 }
Exemplo n.º 7
0
 public override IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx, IssueLogger issues)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
 public void ApplyTransformation(BaseModifications mods, EntityFramework edmx, string[] versions)
 {
     TransformationHelper.ApplyTransformation(this, mods, edmx, versions);
 }