default options if null (#10)

This commit is contained in:
Adam Hathcock
2024-06-19 11:59:57 +01:00
committed by GitHub
parent c71fc31132
commit 1b93e37894
14 changed files with 26 additions and 24 deletions
+1
View File
@@ -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.
@@ -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 { }
@@ -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 //<T> where T : struct
{ }
}
@@ -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<TSource, TTarget>(
@@ -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 { }
}
@@ -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 { }
}
@@ -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
// {
// }
//}
@@ -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();
@@ -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 { }
}
@@ -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 { }
}
@@ -29,9 +29,6 @@
<Compile Update="Interfaces\IClientObject.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
<Compile Update="Interfaces\IListCollection.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
<Compile Update="Interfaces\IUser.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>0.1.10</Version>
<Version>0.1.11</Version>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
@@ -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
);
@@ -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; } = [];