question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fluent API configuration

See original GitHub issue

Your new fluent API isn’t really fluent api. Eg:

new ConfigurationContainer()
  .ConfigureType<TestClassWithEncryptedData>()
    .Member(p => p.Salary).Encrypt()
  .Owner.Configuration
  .ConfigureType<TestClassPrimitiveTypesNullable>()
    .Member(p=>p.PropChar).Encrypt()
  .Owner.Configuration
  .UseEncryptionAlgorithm()
  .Create();

In my last API it was easier to do this:

new ConfigurationContainer()
  .ConfigureType<TestClassWithEncryptedData>()
    .Member(p => p.Salary).Encrypt()
  .ConfigureType<TestClassPrimitiveTypesNullable>()
    .Member(p=>p.PropChar).Encrypt()
  .UseEncryptionAlgorithm()
  .Create();

In your solution all functions are public eg: configuration.Find<EncryptionExtension>(); or configuration.Add<Object>() <-- you are really able to call this

In my only functions to configuration were public. All functions to internal use were internal. In your solution all function are public.

You can get my last API and you can check: git checkout bca8b59a8f04e181a72b636d26597e1fc942738f

For me if you type . in fluent api you should be able to call all functions from your level and all higher level.

What do you think? I wanted to do this but it is very difficult to change in your solution.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
WojciechNagorskicommented, Sep 5, 2017

I look over new API. It looks good. I need to more time to read it and understand all.

I’ve pushed one commit with updating documentation.

1reaction
Mike-E-angelocommented, Sep 5, 2017

OK… I’ve committed in the new ConfigurationAPI, and have gotten rid of a lot of the extension methods. It’s not perfect, but it is more straight-forward and allows you to do the above. Or at least should. All tests are passing. So please take a look at this and if it looks OK to you, go ahead and release alpha 7.

If there are any significant changes that are needed, I would recommend moving them out to 2.1. I am not sure how much I will be able to do in this regard, however. It might take another pass or two to get this as desired, but I think it should do for now and v2. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fluent API Configuration
The Fluent API provides a larger range of configuration options than Data Annotation attributes. Fluent API configuration also facilitates cleaner code, ...
Read more >
Creating and Configuring a Model - EF Core
Fluent API configuration has the highest precedence and will override conventions and data annotations. The configuration is applied in the ...
Read more >
Fluent API in Entity Framework Core
Configurations Fluent API Methods Usage Model Configurations HasDefaultSchema() Specifies the database schema. Entity Configuration HasIndex() Configures an index of the specified properties.
Read more >
Fluent API - Configuring and Mapping Properties and Types
There are two main ways you can configure EF to use something other than conventions, namely annotations or EFs fluent API.
Read more >
Fluent API Configurations in EF 6
Configurations Fluent API Methods Usage Model‑wide Configurations HasDefaultSchema() Specifies the default database schema. Model‑wide Configurations ComplexType() Configures the class as complex type. Entity Configurations HasIndex() Configures...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found