How to pass a custom analyzer to #Indexed annotation? - full-text-indexing

Neo4J lets us provide a custom Analyzer when creating indexes.
How can we achieve this with Spring-Data-Neo4j? Since #Indexed doesn't have this property, what are other options?

Related

ServiceStack.Text JsonConfig Scoping Ignoring Attributes

I'm looking to effectively create logic via attributes on a .net core API project that, depending on a attribute will serialise or de-serialise while ignoring certain properties.
Eg.
If a property was decorated with [OutputOnly] it would not allow users to pass it in via the API, but the API would be able to return this value.
Inversely [InputOnly] would enable users to only pass this value in, but an API would not return this.
The issue I am having is JsConfig static and the property (IgnoreAttributesNamed) that enables Ignoring fields is a singleton too and not part of the Scope functionality in JsConfig.With()
My idea currently is to have an InputFormatter and an OutputFormatter in .net core, that will handle the this logic, but need to be able to config which properties are ignored in those contexts
any suggestions would be greatly appreciated :)
I don't really understand what the goal is here, you would use a Request DTO to define which Parameters a Service Accepts and Response DTO to define what your Service returns, the explicit purpose of the Request/Response DTOs is to define your Services Contract, i.e. the most important contract in your System, whose well-defined interface is used to encapsulate your systems capabilities and is what all consumers of your APIs binds to.
The C# POCO used to define your Request/Response DTO classes should be considered as a DSL for defining the inputs/outputs of your API, trying to collapse and merge their explicit intent of your APIs into multi competing Types with custom attributes is self-defeating, it adds unnecessary confusion, blurs its explicit definition which invalidates the primary purpose of having service contracts which is what all metadata services look at for documenting your API and generating the typed bindings in different supported languages.
So the approach and desired goal for using custom attributes for controlling serialization behavior so you can reuse the same types in different contracts is highly discouraged, but should you wish to continue with this approach you can refer to this answer for different ways to Ignore properties in ServiceStack.Text, specifically ShouldSerailize() API which will allow you to dynamically specify which fields ServiceStack.Text should serialize, if you intend on implementing a convention you can delegate the implementation to a custom extension method, e.g:
class MyRequest
{
public bool? ShouldSerialize(string fieldName) =>
MyUtils.ShouldSerialize(GetType(),fieldName);
}
Other than the linked answer the only other opportunity to manipulate serialization is potentially to use the built-in AutoMapping utils for selecting which properties should be copied over and the Object Dictionary APIs for converting C# Types into an Object Dictionary and manipulate it that way, then can dehydrate it back into the C# type after applying your conventions.

Optimize query with AutoMapper on navigation property table

Use Automapper to expose OData with EF core, data model,
Customer, one to many relation to Order
Order
The Customer class has a ICollection of Order. Used Automapper queryable extension ProjectTo. All works fine.
However, looking at queries sent by EF to SQL, it always sending the queries to the Order even when there is no extend in the OData request. How to correct this?
Yes, that's the default behavior. You have to explicitly tell AM what you don't want it to fetch. See here.

ODataConventionModelBuilder usage

Apart from auto mapping CLR Classes to EDM models, what are the advantages or use-cases for the ODataConventionModelBuilder ?
What specific set of pains does it make go away? With sample code if possible.
ODataConventionModelBuilder is used for generating the Entity Data Model (EDM) for your OData service. The main purpose of EDM is used to define the type system, relationships and the actions that can be exposed by your OData service model.
If you are looking for a specific example, see this link - http://bitoftech.net/2014/04/16/create-read-only-odata-endpoint-using-asp-net-web-api/
In general OdataConventionModelBuilder is preferred over ODataModelBuilder since it infers the inheritance hierarchies, navigation properties and standard properties.
Also look at this link - http://blogs.msdn.com/b/alexj/archive/2012/11/02/odata-in-webapi-microsoft-asp-net-web-api-odata-0-2-0-alpha-release.aspx

generalizing classes or not when using mapper for database

lets say i have the following classes:
customer, applicant, agency, partner
i need to work with databases and use mappers to map the objects to the database. my question is, can i generalize these classes with the class person and just implement a mapper for this class? basically it would look like this:
instead of this:
the mapper classes use orm to save and edit fields in the database, i use them because the application i am doing has to be developed further in the future.
If each of the classes (Partner, Applicant, etc.) has different attributes, you can't have only one mapper for all of the classes (well, you can, but then you would have to use meta-programming to retrieve information from the classes lower down the hierarchy). The solution also depends on how and who manages your database: do you have control over how it is designed or is it something that you cannot change? in the second case I would definitely use a mapper per class to allow full decoupling between DB and app. In the first case, you could use some kind of mapping hierarchy. And also, it depends on what language/frameworks you are using.
Good Luck!

.NET properties in IronPython classes

So I want to create my own Azure Table class that uses only IronPython for declaration. To define such class in C# i use property. How to translate it straight into pythonic way?
I now that when I overrride C# class all properties thanks to reflection to get_Name and set_Name and in this way I can override them. But I want to create new Properties visible in C#. 1
In Python there is property function to create such. But will python property be recognize by C#? I can setter and getter functions rename to C# reflection model. 2
Maybe in assemblies there are some way to create property in other way then syntactic sugar? I didn't find it.
I want to show that there is possibility to use Azure Tables in only IronPython.
I am not familiar with Iron Python. This blog post may help, but it requires us to define the data model in C# and then invoke the data model from Iron Python: http://blog.sharpthinking.com.au/post/2009/02/20/Azure-Table-Storage-in-IronPython.aspx. In the end, table storage is a REST service. So we can use the REST APIs to work with table storage in any language of our choice. If it doesn't offer a client library in the language of our choice, we can build our own. Some third party libraries for OData may also help, as table storage uses OData protocol. I would recommend you to have a look at http://code.google.com/p/odata-py/.
Best Regards,
Ming Xu.

Resources