diff --git a/Changelog.md b/Changelog.md index f637a379a..82ae85912 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,9 @@ * Update nuget dependencies and add new dependencies to OpenRiaServices.Hosting.Wcf * `System.Collections.Immutable` and `System.Memory` are new dependencies of Wcf hosting +* .NET Framework builds now includes the smaller portable pdb's instead of of the old "full" windows style pdb's + * NOTE: For .NET Framework apps ensure that *supportedRuntime* in *app.config* and corresponding setting in *web.config* does not specify an older runtime if you wan't line numbers in stack traces. + # 5.4.2 / AspNetCore 1.0.0 ### .NET8 diff --git a/NuGet/OpenRiaServices.OData/OpenRiaServices.OData.nuspec b/NuGet/OpenRiaServices.OData/OpenRiaServices.OData.nuspec deleted file mode 100644 index 429f47f7d..000000000 --- a/NuGet/OpenRiaServices.OData/OpenRiaServices.OData.nuspec +++ /dev/null @@ -1,35 +0,0 @@ - - - - OpenRiaServices.OData - 4.5.1 - Open RIA Services OData Endpoint - Outercurve RIA Services - Outercurve - Apache-2.0 - https://github.com/OpenRIAServices/OpenRiaServices - false - - OpenRiaServices.OData provides the OpenRiaServices.Hosting.OData assembly, which provides the read only OData endpoint for Domain Services. - - The necessary web.config entries are added with this package as well. - - This assembly is not under active development, future versions of Open RIA Services will support OData using other methods. - - Open RIA Services - OData Endpoint - - 2018 Outercurve Foundation - en-US - WCF RIA Services RIAServices SOAP JSON OpenRiaServices - - - - - - - - - - - - \ No newline at end of file diff --git a/NuGet/OpenRiaServices.OData/content/web.config.transform b/NuGet/OpenRiaServices.OData/content/web.config.transform deleted file mode 100644 index 78870be1e..000000000 --- a/NuGet/OpenRiaServices.OData/content/web.config.transform +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 04520295a..6c35fb6fc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -129,7 +129,7 @@ steps: versionEnvVar: Build.BuildNumber packDestination: '$(Build.ArtifactStagingDirectory)' continueOnError: true - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) +# condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - task: CopyFiles@2 displayName: 'Copy VS Extension: $(build.artifactstagingdirectory)' diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f28f730cf..5a0ff3fad 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -51,13 +51,7 @@ $(MSBuildThisFileDirectory)\snk\Tests.snk true - portable - pdbonly - diff --git a/src/OpenRiaServices.Client/Framework/Entity.cs b/src/OpenRiaServices.Client/Framework/Entity.cs index 8757f4f3a..ac9a8933c 100644 --- a/src/OpenRiaServices.Client/Framework/Entity.cs +++ b/src/OpenRiaServices.Client/Framework/Entity.cs @@ -250,8 +250,8 @@ private set EntitySet entitySet = this.LastSet; if (entitySet != null) { - bool isInteresting = this._entityState != EntityState.Unmodified - && this._entityState != EntityState.Detached; + bool isInteresting = this._entityState is not EntityState.Unmodified + and not EntityState.Detached; entitySet.TrackAsInteresting(this, isInteresting); } @@ -302,12 +302,9 @@ internal void OnChildUpdate() } } - if (this.EntitySet != null) - { - // when a child has been changed in any way, the parent becomes - // interesting - this.EntitySet.TrackAsInteresting(this, true); - } + // when a child has been changed in any way, the parent becomes + // interesting + this.EntitySet?.TrackAsInteresting(this, true); } /// @@ -526,8 +523,7 @@ private set this._isMerging = value; foreach (MetaMember metaMember in MetaType.DataMembers.Where(f => f.IsComplex && !f.IsCollection)) { - ComplexObject propertyValue = metaMember.GetValue(this) as ComplexObject; - if (propertyValue != null) + if (metaMember.GetValue(this) is ComplexObject propertyValue) { propertyValue.IsMergingState = this._isMerging; } @@ -647,10 +643,7 @@ internal void Reset() this._editSession = null; this._trackChanges = false; UndoAllEntityActions(throwIfSubmitting: true); - if (this._validationErrors != null) - { - this._validationErrors.Clear(); - } + this._validationErrors?.Clear(); this.EntityConflict = null; this.EntitySet = null; this._lastSet = null; @@ -682,8 +675,8 @@ internal void StopTracking() /// protected void AcceptChanges() { - if (this.EntityState == EntityState.Unmodified || - this.EntityState == EntityState.Detached) + if (this.EntityState is EntityState.Unmodified or + EntityState.Detached) { // if we're detached or have no changes, noop after // closing any in progress edit session @@ -696,11 +689,7 @@ protected void AcceptChanges() // Accept any child changes. Note, we must accept child changes before setting our own // state to Unmodified. This avoids a situation where we get notifications from child // entities that cause our state to flip back to Modified. - if (entitySet != null) - { - // accept any child changes - entitySet.EntityContainer.CompleteChildChanges(this, true); - } + entitySet?.EntityContainer.CompleteChildChanges(this, true); if (this.EntityState == EntityState.New) { @@ -730,19 +719,13 @@ protected void AcceptChanges() else if (this.EntityState == EntityState.Deleted) { this.StopTracking(); - if (entitySet != null) - { - entitySet.RemoveFromCache(this); - } + entitySet?.RemoveFromCache(this); // move back to the default state this.EntityState = EntityState.Detached; } - if (entitySet != null) - { - // remove from the interesting entities set - entitySet.TrackAsInteresting(this, false); - } + // remove from the interesting entities set + entitySet?.TrackAsInteresting(this, false); // need to end any in progress edit session this._editSession = null; @@ -750,10 +733,7 @@ protected void AcceptChanges() // clear all custom method invocations this.UndoAllEntityActions(throwIfSubmitting: false); - if (this._validationErrors != null) - { - this._validationErrors.Clear(); - } + this._validationErrors?.Clear(); this.EntityConflict = null; this.IsInferred = false; this._hasChildChanges = false; @@ -769,8 +749,8 @@ protected void AcceptChanges() /// protected void RejectChanges() { - if (this.EntityState == EntityState.Unmodified || - this.EntityState == EntityState.Detached) + if (this.EntityState is EntityState.Unmodified or + EntityState.Detached) { // if we're detached or have no changes, noop after // closing any in progress edit session @@ -783,10 +763,7 @@ protected void RejectChanges() // Reject any child changes. Note, we must reject child changes before setting our own // state to Unmodified. This avoids a situation where we get notifications from child // entities that cause our state to flip back to Modified. - if (entitySet != null) - { - entitySet.EntityContainer.CompleteChildChanges(this, false); - } + entitySet?.EntityContainer.CompleteChildChanges(this, false); if (this._entityState == EntityState.Modified || this.Parent != null) { @@ -830,10 +807,7 @@ protected void RejectChanges() UndoAllEntityActions(); // Empty out the error collections - if (this._validationErrors != null) - { - this._validationErrors.Clear(); - } + this._validationErrors?.Clear(); this.EntityConflict = null; this._hasChildChanges = false; Debug.Assert(!this.HasChanges, "Entity.HasChanges should be false"); @@ -1845,7 +1819,7 @@ private EditSession(Entity entity) { this._entity = entity; this._lastState = entity.EntityState; - this._customMethodInvocations = entity._customMethodInvocations != null ? entity._customMethodInvocations.ToArray() : null; + this._customMethodInvocations = entity._customMethodInvocations?.ToArray(); this._validationErrors = entity.ValidationErrors.ToArray(); this._modifiedProperties = new List(); } diff --git a/src/OpenRiaServices.Client/Framework/EntitySet.cs b/src/OpenRiaServices.Client/Framework/EntitySet.cs index 000a00829..9780c714c 100644 --- a/src/OpenRiaServices.Client/Framework/EntitySet.cs +++ b/src/OpenRiaServices.Client/Framework/EntitySet.cs @@ -27,9 +27,9 @@ public abstract class EntitySet : IEnumerable, ICollection, INotifyCollectionCha // backing entity list private IList _list; // set of entities, for fast lookup - private HashSet _set; - private Dictionary _identityCache; - private readonly HashSet _interestingEntities; + private readonly HashSet _set = new(); + private readonly Dictionary _identityCache = new(); + private readonly HashSet _interestingEntities = new(); private NotifyCollectionChangedEventHandler _collectionChangedEventHandler; /// @@ -49,8 +49,6 @@ internal EntitySet(Type entityType) } this._entityType = entityType; - this._identityCache = new Dictionary(); - this._interestingEntities = new HashSet(); } /// @@ -58,9 +56,9 @@ internal EntitySet(Type entityType) /// public Type EntityType { - get - { - return this._entityType; + get + { + return this._entityType; } } @@ -117,10 +115,10 @@ public void Clear() entity.Reset(); } - this._identityCache = new Dictionary(); + this._identityCache.Clear(); this._interestingEntities.Clear(); this._list = this.CreateList(); - this._set = new HashSet(); + this._set.Clear(); this.OnCollectionChanged(NotifyCollectionChangedAction.Reset, clearedEntities, -1); @@ -198,29 +196,22 @@ internal void TrackAsInteresting(Entity entity, bool isInteresting) { if (isInteresting) { - if (!this.InterestingEntities.Contains(entity)) + if (this._interestingEntities.Add(entity) + && this._interestingEntities.Count == 1) { - this._interestingEntities.Add(entity); - if (this._interestingEntities.Count == 1) - { - // this is the first interesting entity in this set - // so raise the change notifications - this.RaisePropertyChanged(nameof(HasChanges)); - } + // this is the first interesting entity in this set + // so raise the change notifications + this.RaisePropertyChanged(nameof(HasChanges)); } } else { - if (this._interestingEntities != null) + if (this._interestingEntities.Remove(entity) + && this._interestingEntities.Count == 0) { - int prevCount = this._interestingEntities.Count; - this._interestingEntities.Remove(entity); - if (this._interestingEntities.Count == 0 && prevCount == 1) - { - // if the last interesting entity has been removed, this set - // no longer has changes, so raise the change notifications - this.RaisePropertyChanged(nameof(HasChanges)); - } + // if the last interesting entity has been removed, this set + // no longer has changes, so raise the change notifications + this.RaisePropertyChanged(nameof(HasChanges)); } } } @@ -274,7 +265,6 @@ internal void Initialize(EntityContainer container, EntitySetOperations operatio this._supportedOperations = operationsToSupport; this._list = this.CreateList(); - this._set = new HashSet(); } /// @@ -317,8 +307,7 @@ internal void UpdateRelatedAssociations(Entity entity, string propertyName) /// True if the callback is being registered, false if it is being unregistered internal void RegisterAssociationCallback(AssociationAttribute association, Action callback, bool register) { - Action del = null; - this._associationUpdateCallbackMap.TryGetValue(association, out del); + this._associationUpdateCallbackMap.TryGetValue(association, out Action del); if (register) { this._associationUpdateCallbackMap[association] = (Action)Delegate.Combine(del, callback); @@ -364,7 +353,7 @@ internal bool IsAttached(Entity entity) // An entity is considered attached if it is in this set or // if it is "know" by this set, for example having been deleted - return entity.EntitySet == this || this.InterestingEntities.Contains(entity); + return entity.EntitySet == this || this._interestingEntities.Contains(entity); } /// @@ -404,9 +393,10 @@ internal void AddInternal(Entity entity) // - scenarios where the entity instance itself is the one already cached (for infer attach // state transition scenarios) object identity = entity.GetIdentity(); - Entity cachedEntity = null; - if (identity != null && this._identityCache.TryGetValue(identity, out cachedEntity) && - cachedEntity.EntityState != EntityState.Deleted && !(object.ReferenceEquals(entity, cachedEntity))) + if (identity != null + && this._identityCache.TryGetValue(identity, out Entity cachedEntity) + && cachedEntity.EntityState != EntityState.Deleted + && !object.ReferenceEquals(entity, cachedEntity)) { throw new InvalidOperationException(Resource.EntitySet_DuplicateIdentity); } @@ -421,10 +411,9 @@ internal void AddInternal(Entity entity) entity.UndoDelete(); } - if (!this._set.Contains(entity)) + if (this._set.Add(entity)) { int idx = this._list.Add(entity); - this._set.Add(entity); entity.EntitySet = this; this.OnCollectionChanged(NotifyCollectionChangedAction.Add, entity, idx); } @@ -494,7 +483,7 @@ public void Remove(Entity entity) internal bool Contains(Entity entity) { - return this._set != null && this._set.Contains(entity); + return this._set.Contains(entity); } /// @@ -745,11 +734,10 @@ internal Entity LoadEntity(Entity entity, LoadBehavior loadBehavior) cachedEntity = entity; int idx = 0; - bool isInList = this._set.Contains(entity); - if (!isInList) + bool isAdded = this._set.Add(entity); + if (isAdded) { idx = this._list.Add(entity); - this._set.Add(entity); } entity.MarkUnmodified(); @@ -764,7 +752,7 @@ internal Entity LoadEntity(Entity entity, LoadBehavior loadBehavior) entity.OnLoaded(true); - if (!isInList) + if (isAdded) { this.OnCollectionChanged(NotifyCollectionChangedAction.Add, entity, idx); } @@ -936,23 +924,23 @@ protected virtual void OnCollectionChanged(NotifyCollectionChangedAction action, } } -#region IEnumerable Members + #region IEnumerable Members IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } -#endregion + #endregion -#region ICollection Members + #region ICollection Members bool ICollection.IsSynchronized { get { return false; } } object ICollection.SyncRoot { get { return _list.SyncRoot; } } void ICollection.CopyTo(Array array, int index) { this._list.CopyTo(array, index); } -#endregion + #endregion -#region INotifyCollectionChanged Members + #region INotifyCollectionChanged Members /// /// Event raised when the collection has changed, or the collection is reset. @@ -969,18 +957,18 @@ public event NotifyCollectionChangedEventHandler CollectionChanged } } -#endregion + #endregion -#region IRevertibleChangeTracking Members + #region IRevertibleChangeTracking Members void IRevertibleChangeTracking.RejectChanges() { this.RejectChanges(); } -#endregion + #endregion -#region IChangeTracking Members + #region IChangeTracking Members bool IChangeTracking.IsChanged { @@ -995,9 +983,9 @@ void IChangeTracking.AcceptChanges() this.AcceptChanges(); } -#endregion + #endregion -#region INotifyPropertyChanged Members + #region INotifyPropertyChanged Members /// /// Event raised when a property has changed. /// @@ -1017,7 +1005,7 @@ protected void RaisePropertyChanged(string propertyName) } } -#endregion + #endregion /// /// Visitor used to traverse all associations in a graph and infer @@ -1025,7 +1013,7 @@ protected void RaisePropertyChanged(string propertyName) /// private class AddAttachInferrer : EntityVisitor { - private readonly Dictionary _visited = new Dictionary(); + private readonly HashSet _visited = new HashSet(); private readonly EntityContainer _container; private bool _isTopLevel = true; private readonly Action _action; @@ -1056,22 +1044,32 @@ private AddAttachInferrer(EntityContainer container, Action a public override void Visit(Entity entity) { - // avoid cycles - if (this._visited.ContainsKey(entity)) + // avoid cycles, stop if entity has already been visisted + if (!this._visited.Add(entity)) { return; } EntitySet set = this._container.GetEntitySet(entity.GetType()); - if (!this._isTopLevel && !set.IsAttached(entity)) + if (!this._isTopLevel) { - // infer for all detached entities except the root - entity.IsInferred = true; - this._action(set, entity); + if (!set.IsAttached(entity)) + { + // infer for all detached entities except the root + entity.IsInferred = true; + this._action(set, entity); + } + else + { + // Entity is attached so state must anything but Detached: New, Unmodified, Modified, Deleted + // * For New, Unchanged, Modified then all changes to EntityRef/EntityCollections are tracked and corresponding entities are + // added directly to the EntitySet, so any changes there will have been previously processed + // * Deleted => Are not tracked (just as for Detached handled above) so they might point to new entities to discover + if (entity.EntityState != EntityState.Deleted) + return; + } } - this._visited.Add(entity, true); - this._isTopLevel = false; base.Visit(entity); @@ -1210,14 +1208,14 @@ protected override void VisitEntityRef(IEntityRef entityRef, Entity parent, Meta } } } - + /// /// Represents a collection of instances, providing change tracking and other services. /// /// The type of this set will contain public sealed class EntitySet : EntitySet, IEntityCollection #if HAS_COLLECTIONVIEW - , ICollectionViewFactory + , ICollectionViewFactory #endif where TEntity : Entity { @@ -1342,14 +1340,14 @@ protected override void OnCollectionChanged(NotifyCollectionChangedAction action base.OnCollectionChanged(action, affectedObject, index); } -#region IEnumerable Members + #region IEnumerable Members IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } -#endregion + #endregion -#region ICollection Members + #region ICollection Members void ICollection.CopyTo(TEntity[] array, int arrayIndex) { ((IList)List).CopyTo(array, arrayIndex); @@ -1377,9 +1375,9 @@ bool ICollection.Remove(TEntity item) throw; } } -#endregion + #endregion -#region ICollectionViewFactory + #region ICollectionViewFactory #if HAS_COLLECTIONVIEW /// /// Returns a custom view for specialized sorting, filtering, grouping, and currency. @@ -1388,7 +1386,7 @@ bool ICollection.Remove(TEntity item) ICollectionView ICollectionViewFactory.CreateView() { // We use the CollectionViewSource to obtain a ListCollectionView, a type internal to Silverlight - return new CollectionViewSource() { Source = new ListCollectionViewProxy(this) } .View; + return new CollectionViewSource() { Source = new ListCollectionViewProxy(this) }.View; } /// @@ -1413,7 +1411,7 @@ internal ListCollectionViewProxy(EntitySet source) WeakCollectionChangedListener.CreateIfNecessary(this._source, this); } -#region IList + #region IList public int Add(object value) { @@ -1425,8 +1423,12 @@ public int Add(object value) nameof(value)); } + int countBefore = this.Source.Count; this.Source.Add(entity); - return this.IndexOf(entity); + int countAfter = this.Source.Count; + + // If count increased then the item was added last, otherwise return -1 for "not added" + return (countAfter > countBefore) ? countBefore : -1; } public void Clear() @@ -1436,7 +1438,7 @@ public void Clear() public bool Contains(object value) { - return this.IndexOf(value) >= 0; + return (value is Entity e) && this.Source.Contains(e); } public int IndexOf(object value) @@ -1462,13 +1464,10 @@ public bool IsReadOnly public void Remove(object value) { - T entity = (T)value; - if (entity == null) + if (value is T entity) { - return; + this.Source.Remove(entity); } - - this.Source.Remove(entity); } public void RemoveAt(int index) @@ -1480,10 +1479,6 @@ public object this[int index] { get { - if ((index < 0) || (index >= this.Source.Count)) - { - throw new ArgumentOutOfRangeException(nameof(index)); - } return this.Source.List[index]; } set @@ -1528,9 +1523,9 @@ private EntitySet Source get { return this._source; } } -#endregion + #endregion -#region INotifyCollectionChanged + #region INotifyCollectionChanged public event NotifyCollectionChangedEventHandler CollectionChanged; @@ -1544,18 +1539,18 @@ private void OnSourceCollectionChanged(object sender, NotifyCollectionChangedEve this.OnCollectionChanged(e); } -#endregion + #endregion -#region ICollectionChangedListener + #region ICollectionChangedListener void ICollectionChangedListener.OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { this.OnSourceCollectionChanged(sender, e); } -#endregion + #endregion } #endif -#endregion + #endregion } } diff --git a/src/OpenRiaServices.Client/Framework/Internal/MetaType.cs b/src/OpenRiaServices.Client/Framework/Internal/MetaType.cs index 4df035b2c..cb13c341d 100644 --- a/src/OpenRiaServices.Client/Framework/Internal/MetaType.cs +++ b/src/OpenRiaServices.Client/Framework/Internal/MetaType.cs @@ -31,6 +31,7 @@ public sealed class MetaType private readonly ReadOnlyCollection _dataMembers; private readonly ReadOnlyCollection _validationAttributes; private readonly Dictionary _customUpdateMethods; + private readonly MetaMember[] _associationMembers; /// /// Returns the MetaType for the specified Type. @@ -115,6 +116,7 @@ select attribute // for identity purposes, we need to make sure values are always ordered KeyMembers = new ReadOnlyCollection(_metaMembers.Values.Where(m => m.IsKeyMember).OrderBy(m => m.Name).ToArray()); _dataMembers = new ReadOnlyCollection(_metaMembers.Values.Where(m => m.IsDataMember).ToArray()); + _associationMembers = _metaMembers.Values.Where(m => m.IsAssociationMember).ToArray(); if (!_requiresValidation && HasComplexMembers) { @@ -219,13 +221,7 @@ public IEnumerable GetEntityActions() /// /// Gets the collection of association members for this entity Type. /// - public IEnumerable AssociationMembers - { - get - { - return this._metaMembers.Values.Where(m => m.IsAssociationMember); - } - } + public IEnumerable AssociationMembers => _associationMembers; /// /// Gets the collection of child types this entity Type composes. diff --git a/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj b/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj index 253107df9..955cba09e 100644 --- a/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj +++ b/src/OpenRiaServices.Client/Test/Client.External.Test/OpenRiaServices.Client.External.Test.csproj @@ -5,8 +5,8 @@ - - + + diff --git a/src/OpenRiaServices.Client/Test/Client.Test/Data/EntityContainerTests.cs b/src/OpenRiaServices.Client/Test/Client.Test/Data/EntityContainerTests.cs index e2d670cf6..87cd05e3d 100644 --- a/src/OpenRiaServices.Client/Test/Client.Test/Data/EntityContainerTests.cs +++ b/src/OpenRiaServices.Client/Test/Client.Test/Data/EntityContainerTests.cs @@ -3832,6 +3832,49 @@ public void EntitySet_Detach() Assert.IsTrue(ec.GetChanges().IsEmpty); } + + [TestMethod] + public void EntitySet_Remove_Inferred_Entities() + { + TestEntityContainer ec = new TestEntityContainer(); + EntitySet products = ec.GetEntitySet(); + + // attach a product + Product product = new Product + { + ProductID = 1, + Name = "Choco Crisp", + }; + // EntityCollection + var order = new PurchaseOrder { PurchaseOrderID = 1 }; + var detail1 = new PurchaseOrderDetail() { PurchaseOrder = order, PurchaseOrderID = 1, PurchaseOrderDetailID = 1 }; + product.PurchaseOrderDetails.Add(detail1); + products.Attach(product); + + // Delete the entity, it should be marked for deletion + products.Remove(product); + Assert.AreEqual(EntityState.Deleted, product.EntityState); + Assert.AreEqual(EntityState.Unmodified, detail1.EntityState); + Assert.AreEqual(EntityState.Unmodified, order.EntityState); + + var detail2 = new PurchaseOrderDetail() { PurchaseOrderDetailID = 2, Product = product, PurchaseOrderID = order.PurchaseOrderID }; + var detail3 = new PurchaseOrderDetail() { PurchaseOrderDetailID = 3, Product = product, PurchaseOrderID = order.PurchaseOrderID }; + + product.PurchaseOrderDetails.Add(detail2); + product.PurchaseOrderDetails.Add(detail3); + + Assert.AreEqual(EntityState.Deleted, product.EntityState); + Assert.AreEqual(EntityState.Detached, detail2.EntityState); + Assert.AreEqual(EntityState.Detached, detail3.EntityState); + + // Add detail2, which should trigger detail3 to be discovered via product (which should still be deleted) + order.PurchaseOrderDetails.Add(detail2); + + Assert.AreEqual(EntityState.Deleted, product.EntityState); + Assert.AreEqual(EntityState.New, detail2.EntityState); + Assert.AreEqual(EntityState.New, detail3.EntityState); + } + [TestMethod] public void EntitySet_CollectionChangedEvents() { diff --git a/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj b/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj index 81d9315ac..d51d4d7a9 100644 --- a/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj +++ b/src/OpenRiaServices.Client/Test/Client.Test/OpenRiaServices.Client.Test.csproj @@ -14,10 +14,11 @@ - - + + + - + diff --git a/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj b/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj index 8d4a34d51..7ac307857 100644 --- a/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj +++ b/src/OpenRiaServices.Client/Test/Client.Vb.Test/OpenRiaServices.Client.Vb.Test.csproj @@ -9,10 +9,10 @@ - - + + - + diff --git a/src/OpenRiaServices.EntityFramework/Test/CodeFirstModel/EFCodeFirstModels.csproj b/src/OpenRiaServices.EntityFramework/Test/CodeFirstModel/EFCodeFirstModels.csproj index 4095421ae..9596a371c 100644 --- a/src/OpenRiaServices.EntityFramework/Test/CodeFirstModel/EFCodeFirstModels.csproj +++ b/src/OpenRiaServices.EntityFramework/Test/CodeFirstModel/EFCodeFirstModels.csproj @@ -7,10 +7,6 @@ $(DefineConstants);DBCONTEXT 1.0.0.0 - - - - diff --git a/src/OpenRiaServices.EntityFramework/Test/DbContextModel/EFDbContextModels.csproj b/src/OpenRiaServices.EntityFramework/Test/DbContextModel/EFDbContextModels.csproj index 2cd471e5c..260a4989e 100644 --- a/src/OpenRiaServices.EntityFramework/Test/DbContextModel/EFDbContextModels.csproj +++ b/src/OpenRiaServices.EntityFramework/Test/DbContextModel/EFDbContextModels.csproj @@ -6,10 +6,6 @@ net472;net6.0 1.0.0.0 - - - - diff --git a/src/OpenRiaServices.Hosting.AspNetCore/Framework/OpenRiaServices.Hosting.AspNetCore.csproj b/src/OpenRiaServices.Hosting.AspNetCore/Framework/OpenRiaServices.Hosting.AspNetCore.csproj index 2b9bc2816..eededa377 100644 --- a/src/OpenRiaServices.Hosting.AspNetCore/Framework/OpenRiaServices.Hosting.AspNetCore.csproj +++ b/src/OpenRiaServices.Hosting.AspNetCore/Framework/OpenRiaServices.Hosting.AspNetCore.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 $(DefineConstants);SERVERFX;ASPNET_CORE OpenRiaServices.Hosting diff --git a/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj b/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj index 7bd765c2b..fba6004aa 100644 --- a/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj +++ b/src/OpenRiaServices.Hosting.AspNetCore/Test/OpenRiaServices.Hosting.AspNetCore.Test/OpenRiaServices.Hosting.AspNetCore.Test.csproj @@ -6,10 +6,10 @@ - + - - + + diff --git a/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj b/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj index 0bc27b36e..817a77434 100644 --- a/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj +++ b/src/OpenRiaServices.Hosting.Local/Test/OpenRiaServices.Hosting.Local.Test.csproj @@ -2,14 +2,10 @@ net472 - - - - - - + + diff --git a/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj b/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj index 292f5137d..b06ec1c77 100644 --- a/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj +++ b/src/OpenRiaServices.Hosting.Wcf.Endpoint/Test/OpenRiaServices.Hosting.Wcf.Endpoint.Test.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj b/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj index 5754155d8..5a2b7a4f8 100644 --- a/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj +++ b/src/OpenRiaServices.Hosting.Wcf/Test/OpenRiaServices.Hosting.Wcf.Test.csproj @@ -5,10 +5,10 @@ - + - - + + diff --git a/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj b/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj index 096579919..555cfb114 100644 --- a/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj +++ b/src/OpenRiaServices.Server.Authentication.AspNetMembership/Test/OpenRiaServices.Server.Authentication.AspNetMembership.Test.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj b/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj index 75be803ca..6bfa2ac47 100644 --- a/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj +++ b/src/OpenRiaServices.Server.UnitTesting/Test/OpenRiaServices.Server.UnitTesting.Test.csproj @@ -5,10 +5,10 @@ net472;net6.0;net8.0 - + - - + + diff --git a/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj b/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj index 65cc69962..a92b471aa 100644 --- a/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj +++ b/src/OpenRiaServices.Server/Test/OpenRiaServices.Server.Test.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj b/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj index cea7ffcc3..1b068ad74 100644 --- a/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj +++ b/src/OpenRiaServices.Tools.TextTemplate/Test/OpenRiaServices.Tools.TextTemplate.Test.csproj @@ -45,8 +45,8 @@ - - + + diff --git a/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs b/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs index c03d4c5c5..eac8dd897 100644 --- a/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs +++ b/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs @@ -2,7 +2,6 @@ using System.CodeDom; using System.Collections.Generic; using OpenRiaServices.Server; -using OpenRiaServices.Server.Test.Utilities; using System.Xml; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -41,7 +40,7 @@ public static IEnumerable PartialMethodsSnippetBlockTestCases DynamicData(nameof(PartialMethodsSnippetBlockTestCases))] public void PartialMethodsSnippetBlockTest(string comments, string baseMethodNames, string parameters) { - string[] baseMethodNamesArray = baseMethodNames.Split(new char[] { ',' }); + string[] baseMethodNamesArray = baseMethodNames.Split(','); PartialMethodsSnippetBlockTest(true, comments, baseMethodNamesArray, parameters); PartialMethodsSnippetBlockTest(false, comments, baseMethodNamesArray, parameters); @@ -82,7 +81,7 @@ public void PartialMethodsSnippetBlockTest(bool isCSharp, string comments, strin } snippetstr += snippet.Text; } - Assert.AreEqual(snippetstr.Replace("\r\n", "").TrimEnd(), XmlReader.Value.Replace("\n", "")); + Assert.AreEqual(XmlReader.Value.Replace("\n", ""), snippetstr.Replace("\r\n", "").TrimEnd()); } [TestMethod] @@ -96,7 +95,7 @@ public void OnCreatedMethodInvokeExpressionTest(bool isCSharp) { NotificationMethodGenerator target = new NotificationMethodGenerator(CreateProxyGenerator(isCSharp)); - Assert.AreEqual(target.OnCreatedMethodInvokeExpression.Method.MethodName, "OnCreated"); + Assert.AreEqual("OnCreated", target.OnCreatedMethodInvokeExpression.Method.MethodName); } public static IEnumerable OnCreatedMethodInvokeExpressionTestCases @@ -108,7 +107,7 @@ public static IEnumerable OnCreatedMethodInvokeExpressionTestCases ] public void GetMethodInvokeExpressionStatementForTest(string comments, string baseMethodNames, string parameters) { - string[] baseMethodNamesArray = baseMethodNames.Split(new char[] { ',' }); + string[] baseMethodNamesArray = baseMethodNames.Split(','); GetMethodInvokeExpressionStatementForTest(true, comments, baseMethodNamesArray, parameters); GetMethodInvokeExpressionStatementForTest(false, comments, baseMethodNamesArray, parameters); @@ -128,14 +127,14 @@ public void GetMethodInvokeExpressionStatementForTest(bool isCSharp, string comm target.AddMethodFor(baseMethodName, expressions, comments); CodeExpressionStatement actual = target.GetMethodInvokeExpressionStatementFor(baseMethodName); - CodeMethodInvokeExpression actualExpression = actual.Expression as CodeMethodInvokeExpression; + CodeMethodInvokeExpression actualExpression = (CodeMethodInvokeExpression)actual.Expression; - Assert.AreEqual(actualExpression.Method.MethodName, "On" + baseMethodName); + Assert.AreEqual("On" + baseMethodName, actualExpression.Method.MethodName); for (int idx = 0; idx < parameters.Length; idx++) { string paramName = ((CodeArgumentReferenceExpression)actualExpression.Parameters[idx]).ParameterName; - Assert.AreEqual(paramName, parameters[idx].Name); + Assert.AreEqual(parameters[idx].Name, paramName); } } } @@ -188,7 +187,7 @@ public void AddMethodFor2Test(bool isCSharp, string comments, string paramDeclAr } else if (paramDeclArgs != "null") { - string[] args = paramDeclArgs.Split(new char[] { ',' }); + string[] args = paramDeclArgs.Split(','); parameterDeclaration = new CodeParameterDeclarationExpression(args[0], args[1]); } @@ -251,13 +250,13 @@ private static CodeParameterDeclarationExpressionCollection GetCodeParameterDecl { parameters = new CodeParameterDeclarationExpressionCollection(); - string[] paramDecls = paramDeclsArgs.Split(new char[] { ';' }); + string[] paramDecls = paramDeclsArgs.Split(';'); foreach (string paramDecl in paramDecls) { if (paramDecl != "") { - string[] args = paramDecl.Split(new char[] { ',' }); - Assert.AreEqual(args.Length, 2, "Params definition file not in the correct format!"); + string[] args = paramDecl.Split(','); + Assert.AreEqual(2, args.Length, "Params definition file not in the correct format!"); CodeParameterDeclarationExpression codeParam = new CodeParameterDeclarationExpression(args[0], args[1]); parameters.Add(codeParam); } diff --git a/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj b/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj index 1e356ea82..c3b714a3e 100644 --- a/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj +++ b/src/OpenRiaServices.Tools/Test/OpenRiaServices.Tools.Test.csproj @@ -30,8 +30,8 @@ - - + + diff --git a/src/Test/Desktop/OpenRiaServices.Common.Test/OpenRiaServices.Common.Test.csproj b/src/Test/Desktop/OpenRiaServices.Common.Test/OpenRiaServices.Common.Test.csproj index 2071ff326..47b3474eb 100644 --- a/src/Test/Desktop/OpenRiaServices.Common.Test/OpenRiaServices.Common.Test.csproj +++ b/src/Test/Desktop/OpenRiaServices.Common.Test/OpenRiaServices.Common.Test.csproj @@ -5,10 +5,10 @@ - + - + diff --git a/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj b/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj index f98c25f70..8f6bbf379 100644 --- a/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj +++ b/src/Test/OpenRiaservices.EndToEnd.AspNetCore.Test/OpenRiaservices.EndToEnd.AspNetCore.Test.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj index 951360f6c..9ad97f28b 100644 --- a/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj +++ b/src/Test/OpenRiaservices.EndToEnd.Wcf.Test/OpenRiaservices.EndToEnd.Wcf.Test.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/src/Test/WebsiteFullTrust/Web.config b/src/Test/WebsiteFullTrust/Web.config index d4d24be62..3ce7c9e17 100644 --- a/src/Test/WebsiteFullTrust/Web.config +++ b/src/Test/WebsiteFullTrust/Web.config @@ -76,6 +76,18 @@ + + + + + + + + + + + + @@ -92,6 +104,14 @@ + + + + + + + + @@ -108,26 +128,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj b/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj index ea3c9daec..012e02ada 100644 --- a/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj +++ b/src/VisualStudio/Tools/Test/OpenRiaServices.VisualStudio.DomainServices.Tools.Test.csproj @@ -16,8 +16,8 @@ - - + +