versionone / VersionOne.SDK.NET.APIClient

A library for .NET development with the VersionOne REST API.
BSD 3-Clause "New" or "Revised" License
10 stars 15 forks source link

FluentQuery support (was V1ServiceFactory) #15

Open GriffinNowak opened 9 years ago

GriffinNowak commented 9 years ago

Fluent Queries are the best thing to ever hit this API. Thing is the service factory is using the depreciated V1APIConnector. I haven't found a way around it either. I'm trying.

ghost commented 9 years ago

Glad you like the fluent interface!

We'll take a look from our side for the service factory issue.

GriffinNowak commented 9 years ago

I was just about to email you. And yes it's very very very nice. I looked into replacing it but have run into quite a few problems. Namely the fact that it doesn't recognize the V1Connector. If you can figure it out I'd love to see it.

GriffinNowak commented 9 years ago

Also, is there a way we could get a ASP.NET MVC example? That'd work wonders for me.

ghost commented 9 years ago

Can you clarify what you mean by "V1ServiceFactory"? That currently isn't part of the .NET SDK that we can tell, but perhaps I am not understanding what you mean.

GriffinNowak commented 9 years ago

VersionOne.SDK.NET.APIClient/Example/GettingStarted/src/ Examples is the only place I've seen fluent queries used.

ghost commented 9 years ago

Ok, thanks.

That is an experimental approach that we have been working on, and not something that we are currently supporting.

But thanks for expressing interest!

JogoShugh commented 8 years ago

Sorry it's been so long. I'm glad you liked the FluentQueries. We are picking up this work to get it to become official soon!

GriffinNowak commented 8 years ago

I just interviewed for that internship again Tuesday! I don't think I'll be doing the same thing but you certainly were a great help!

On Thu, Apr 28, 2016 at 1:35 PM Josh Gough notifications@github.com wrote:

Sorry it's been so long. I'm glad you liked the FluentQueries. We are picking up this work to get it to become official soon!

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/versionone/VersionOne.SDK.NET.APIClient/issues/15#issuecomment-215504450

JogoShugh commented 8 years ago

@GriffinNowak I know it might not be of interest anymore based on what you just said, but I just pushed a branch up that brings formal support of the FluentyQuery into the SDK. And, it's totally encsapsulated so there is absolutely no need to worry about the Services class or IMetaModel or anything of that nature.

Here's one of the example programs:

V1Connector
.WithInstanceUrl(BaseUrl)
.WithUserAgentHeader("Sample", "0.0.0")
.WithUsernameAndPassword(UserName, Password)
.Query("TeamRoom")
.Select("Team.Name", "Name")
.Success(assets => {
    foreach (Asset asset in assets)  {
        var team = asset["Team.Name"] + ":" + asset["Name"];
        Console.WriteLine(team);
    }
})
.Execute();

The next thing I'm planning to add is to enhance the Where method such that you'll be able to do things like: .Where(Equals("Name", "The value to match"), NotEquals("CreatedBy", "Somebody you want to exclude...")).

The free-standing Equals and NotEquals functions become possible in C# 6 because you can now import a static class into your scope!