diff --git a/README.md b/README.md index f89877a..76b23d3 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Api Assembly: - Proxy Interfaces that inherit from the base interfaces - Proxy attribute references wrapped Api +- If `ImplementationOptions` is omitted then defaults are used: `ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface` New needs: base interface is used by wrappers. Need to ignore members from wrapped api on demand. diff --git a/src-examples/ProxyInterfaceConsumer/Http/IHttpClient.cs b/src-examples/ProxyInterfaceConsumer/Http/IHttpClient.cs index e3052f4..b2c57ae 100644 --- a/src-examples/ProxyInterfaceConsumer/Http/IHttpClient.cs +++ b/src-examples/ProxyInterfaceConsumer/Http/IHttpClient.cs @@ -6,5 +6,5 @@ namespace ProxyInterfaceConsumer.Http; [Speckle.ProxyGenerator.Proxy(typeof(HttpClient), ImplementationOptions.ProxyBaseClasses)] public partial interface IHttpClient : IHttpMessageInvoker { } -[Speckle.ProxyGenerator.Proxy(typeof(HttpMessageInvoker))] +[Speckle.ProxyGenerator.Proxy(typeof(HttpMessageInvoker), ImplementationOptions.None)] public partial interface IHttpMessageInvoker { } diff --git a/src-examples/ProxyInterfaceConsumer/IPersonT.cs b/src-examples/ProxyInterfaceConsumer/IPersonT.cs index 6d2a8b4..b298614 100644 --- a/src-examples/ProxyInterfaceConsumer/IPersonT.cs +++ b/src-examples/ProxyInterfaceConsumer/IPersonT.cs @@ -1,6 +1,8 @@ +using Speckle.ProxyGenerator; + namespace ProxyInterfaceConsumer { - [Speckle.ProxyGenerator.Proxy(typeof(ProxyInterfaceConsumer.PersonT<>))] + [Speckle.ProxyGenerator.Proxy(typeof(ProxyInterfaceConsumer.PersonT<>), ImplementationOptions.None)] public partial interface IPersonT // where T : struct { } } diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientContext.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientContext.cs index cc95bcd..6f10089 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientContext.cs +++ b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientContext.cs @@ -1,10 +1,11 @@ using System; using System.Linq.Expressions; using Microsoft.SharePoint.Client; +using Speckle.ProxyGenerator; namespace ProxyInterfaceConsumerForPnP.Interfaces { - [Speckle.ProxyGenerator.Proxy(typeof(ClientContext))] + [Speckle.ProxyGenerator.Proxy(typeof(ClientContext), ImplementationOptions.None)] public partial interface IClientContext : IClientRuntimeContext { void Load( diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientObject.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientObject.cs index b3cf2c8..3023941 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientObject.cs +++ b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientObject.cs @@ -1,5 +1,7 @@ +using Speckle.ProxyGenerator; + namespace ProxyInterfaceConsumerForPnP.Interfaces { - [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientObject))] + [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientObject), ImplementationOptions.None)] public partial interface IClientObject { } } diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientRuntimeContext.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientRuntimeContext.cs index 60115fa..eb558ef 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientRuntimeContext.cs +++ b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IClientRuntimeContext.cs @@ -1,5 +1,7 @@ +using Speckle.ProxyGenerator; + namespace ProxyInterfaceConsumerForPnP.Interfaces { - [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientRuntimeContext))] + [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientRuntimeContext), ImplementationOptions.None)] public partial interface IClientRuntimeContext { } } diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IListCollection.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IListCollection.cs deleted file mode 100644 index ad13290..0000000 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IListCollection.cs +++ /dev/null @@ -1,10 +0,0 @@ -//using System.Collections; -//using System.Linq; - -//namespace ProxyInterfaceConsumerForPnP.Interfaces -//{ -// [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ListCollection))] -// public partial interface IProxyListCollection: IClientObject, IEnumerable, IQueryable -// { -// } -//} diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/ISecurableObject.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/ISecurableObject.cs index 06eea32..8810a87 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/ISecurableObject.cs +++ b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/ISecurableObject.cs @@ -1,6 +1,8 @@ +using Speckle.ProxyGenerator; + namespace ProxyInterfaceConsumerForPnP.Interfaces { - [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.SecurableObject))] + [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.SecurableObject), ImplementationOptions.None)] public partial interface ISecurableObject : IClientObject { // public virtual void X(); diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IUser.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IUser.cs index e41d282..0ba6d85 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IUser.cs +++ b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IUser.cs @@ -1,5 +1,7 @@ +using Speckle.ProxyGenerator; + namespace ProxyInterfaceConsumerForPnP.Interfaces { - [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.User))] + [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.User), ImplementationOptions.None)] public partial interface IUser { } } diff --git a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IWeb.cs b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IWeb.cs index eab6536..cb3d808 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IWeb.cs +++ b/src-examples/ProxyInterfaceConsumerForPnP/Interfaces/IWeb.cs @@ -1,5 +1,7 @@ +using Speckle.ProxyGenerator; + namespace ProxyInterfaceConsumerForPnP.Interfaces { - [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.Web))] + [Speckle.ProxyGenerator.Proxy(typeof(Microsoft.SharePoint.Client.Web), ImplementationOptions.None)] public partial interface IWeb : ISecurableObject { } } diff --git a/src-examples/ProxyInterfaceConsumerForPnP/ProxyInterfaceConsumerForPnP.csproj b/src-examples/ProxyInterfaceConsumerForPnP/ProxyInterfaceConsumerForPnP.csproj index 8972d64..52e066b 100644 --- a/src-examples/ProxyInterfaceConsumerForPnP/ProxyInterfaceConsumerForPnP.csproj +++ b/src-examples/ProxyInterfaceConsumerForPnP/ProxyInterfaceConsumerForPnP.csproj @@ -29,9 +29,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest diff --git a/src/Speckle.ProxyGenerator/Speckle.ProxyGenerator.csproj b/src/Speckle.ProxyGenerator/Speckle.ProxyGenerator.csproj index 2c5ec14..6d853af 100644 --- a/src/Speckle.ProxyGenerator/Speckle.ProxyGenerator.csproj +++ b/src/Speckle.ProxyGenerator/Speckle.ProxyGenerator.csproj @@ -1,7 +1,7 @@ - 0.1.10 + 0.1.11 netstandard2.0 Latest enable diff --git a/src/Speckle.ProxyGenerator/SyntaxReceiver/ProxySyntaxReceiver.cs b/src/Speckle.ProxyGenerator/SyntaxReceiver/ProxySyntaxReceiver.cs index 8c299e5..eb6ca66 100644 --- a/src/Speckle.ProxyGenerator/SyntaxReceiver/ProxySyntaxReceiver.cs +++ b/src/Speckle.ProxyGenerator/SyntaxReceiver/ProxySyntaxReceiver.cs @@ -3,6 +3,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Speckle.ProxyGenerator.Extensions; using Speckle.ProxyGenerator.Models; +using Speckle.ProxyGenerator.Types; namespace Speckle.ProxyGenerator.SyntaxReceiver; @@ -99,7 +100,7 @@ internal class ProxySyntaxReceiver : ISyntaxContextReceiver fullMetadataTypeName: metadataName, shortMetadataTypeName: metadataName.Split('.').Last(), usings: usings, - options: fluentBuilderAttributeArguments.Options, + options: fluentBuilderAttributeArguments.Options ?? ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface, accessibility: fluentBuilderAttributeArguments.Accessibility, membersToIgnore: fluentBuilderAttributeArguments.MembersToIgnore ); diff --git a/src/Speckle.ProxyGenerator/Types/FluentBuilderAttributeArguments.cs b/src/Speckle.ProxyGenerator/Types/FluentBuilderAttributeArguments.cs index 779704f..beaf38d 100644 --- a/src/Speckle.ProxyGenerator/Types/FluentBuilderAttributeArguments.cs +++ b/src/Speckle.ProxyGenerator/Types/FluentBuilderAttributeArguments.cs @@ -5,7 +5,7 @@ internal record ProxyInterfaceGeneratorAttributeArguments( string MetadataName ) { - public ImplementationOptions Options { get; set; } + public ImplementationOptions? Options { get; set; } public ProxyClassAccessibility Accessibility { get; set; } public string[] MembersToIgnore { get; set; } = [];