public virtual IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx) { if (this.OpenType) { // TODO: This isn't illegal, but we don't know what you're going to get back anyway, so we just treat it the same for now. } throw new NotSupportedException("ComplexType cannot be navigated by key."); }
public override IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx) { var navigationPropertyMatch = (from n in this.NavigationProperties where n.Name == component select n).FirstOrDefault(); if (null != navigationPropertyMatch) { var identifier = navigationPropertyMatch.Type; if (identifier.StartsWith("Collection(")) { var innerId = identifier.Substring(11, identifier.Length - 12); return new ODataCollection(innerId); } return edmx.LookupNavigableType(identifier); } return base.NavigateByUriComponent(component, edmx); }
public virtual IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx) { var propertyMatch = (from p in this.Properties where p.Name == component select p).FirstOrDefault(); if (null != propertyMatch) { var identifier = propertyMatch.Type; if (identifier.StartsWith("Collection(")) { var innerId = identifier.Substring(11, identifier.Length - 12); return new ODataCollection(innerId); } return edmx.ResourceWithIdentifier<IODataNavigable>(identifier); } return null; }
public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx) { string targetType = null; var entitySet = (from e in EntitySets where e.Name == component select e).FirstOrDefault(); if (null != entitySet) { // EntitySet is always a collection of an item type targetType = "Collection(" + entitySet.EntityType + ")"; } else { var singleton = (from s in Singletons where s.Name == component select s).FirstOrDefault(); if (null != singleton) { targetType = singleton.Type; } } if (targetType != null) { if (targetType.StartsWith("Collection(")) { var innerId = targetType.Substring(11, targetType.Length - 12); return new ODataCollection(innerId); } return edmx.ResourceWithIdentifier<IODataNavigable>(targetType); } return null; }
public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx) { // NavigationByUriComponent for a collection means that we have a hard coded key in the example path. return(this.NavigateByEntityTypeKey(edmx)); }
public override IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx) { throw new NotImplementedException(); }
public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx) { throw new NotSupportedException(); }
public override void ApplyTransformation(BaseModifications value, EntityFramework edmx, string[] versions) { base.ApplyTransformation(value, edmx, versions); }
public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx) { throw new NotSupportedException(); }
public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx) { return(edmx.ResourceWithIdentifier <IODataNavigable>(this.TypeIdentifier)); }
/// <summary> /// Generates an entity framework XML file for a given input /// </summary> /// <param name="input"></param> /// <returns></returns> public static string GenerateEdmx(EntityFramework input) { StringBuilder sb = new StringBuilder(); StringWriter stringWriter = new StringWriter(sb); XmlWriter writer = XmlWriter.Create( stringWriter, new XmlWriterSettings { Encoding = new UTF8Encoding(false), OmitXmlDeclaration = true, Indent = true }); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("edmx", ODataParser.EdmxNamespace); XmlSerializer ser = new XmlSerializer(typeof(EntityFramework)); ser.Serialize(writer, input, ns); writer.Flush(); return sb.ToString(); }
/// <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) { return(edmx.DataServices.Schemas.ResourceWithIdentifier <T>(identifier)); }
public IODataNavigable NavigateByEntityTypeKey(EntityFramework edmx) { return edmx.ResourceWithIdentifier<IODataNavigable>(this.TypeIdentifier); }
public IODataNavigable NavigateByUriComponent(string component, EntityFramework edmx) { // NavigationByUriComponent for a collection means that we have a hard coded key in the example path. return this.NavigateByEntityTypeKey(edmx); }
public void ApplyTransformation(BaseModifications mods, EntityFramework edmx, string[] versions) { TransformationHelper.ApplyTransformation(this, mods, edmx, versions); }