public static TEntity Get <TEntity>(TableServiceContext serviceContext, EntitySetName <TEntity> entitySetName, string partitionKey, string rowKey) where TEntity : TableServiceEntity { return(serviceContext.CreateQuery <TEntity>(entitySetName.Name) .Where(a => a.PartitionKey == partitionKey) .Where(a => a.RowKey == rowKey) .FirstOrDefault()); }
public EntitySet(XElement xElement, IEnumerable <CustomAction> customActions, IEnumerable <CustomFunction> functions) { EntitySetName = xElement.Attribute("Name")?.Value; Name = char.ToUpper(EntitySetName[0]) + EntitySetName.Substring(1) + "ODataService"; EntityType = xElement.Attribute("EntityType")?.Value; NameSpace = xElement.Ancestors().FirstOrDefault(a => a.Attribute("Namespace") != null)?.Attribute("Namespace").Value; CustomActions = customActions.Where(a => a.BindingParameter == EntityType); CustomFunctions = functions.Where(a => a.BindingParameter == EntityType); }
/// <summary> /// Serves as a hash function for the objects of <see cref="HiLoIdentityGenerator"/> and its derived types. /// </summary> /// <returns>A hash code for the current <see cref="HiLoIdentityGenerator"/> instance.</returns> public override int GetHashCode() { var hashCode = Constants.HashInitializer; unchecked { hashCode = Constants.HashMultiplier * hashCode + EntitySetName.GetHashCode(); } return(hashCode); }
public static IQueryable <TEntity> Query <TEntity>(TableServiceContext serviceContext, EntitySetName <TEntity> entitySetName, string partitionKey, string fromRowKey = null) where TEntity : TableServiceEntity { IQueryable <TEntity> allEntities = serviceContext.CreateQuery <TEntity>(entitySetName.Name) .Where(a => a.PartitionKey == partitionKey); if (fromRowKey != null) { return(allEntities.Where(a => a.RowKey.CompareTo(fromRowKey) > 0)); } return(allEntities); }
public static void Insert <TEntity>(TableServiceContext serviceContext, EntitySetName <TEntity> entitySetName, TEntity entity) where TEntity : TableServiceEntity { serviceContext.AddObject(entitySetName.Name, entity); serviceContext.SaveChanges(); }