fluent

Fluent NHibernate mapping nullable enum

时光总嘲笑我的痴心妄想 提交于 2019-12-23 09:33:06
问题 I need to map a nullable enum in my class but am getting exceptions. NHibernate.PropertyAccessException: Invalid Cast (check your mapping for property type mismatches); setter of App.Model.Stock ---> System.InvalidCastException: Specified cast is not valid. I have narrowed the issue down to one specific property, which I describe below. This was previously answered here, but the solution links to a page which no longer exists. Here is my code, which I have reduced to contain only the portions

Fluentd: Multiple formats in one match

我的未来我决定 提交于 2019-12-23 04:08:37
问题 I'm new to Fluentd. I have one problem regarding the <match> tag and its format. For example Our system returns 2 different formats: format1 , and format2 at the same tag: tag Using fluent.conf we are able to catch the provided tag but we are unable to separate those two formats I tried the fluent-plugin-multi-format-parser but it does not allow me to add the prefixes. <match tag> @type parser format multi <pattern> format format1 add_prefix pattern1 ... </pattern> <pattern> format format2

Fluentd: Multiple formats in one match

夙愿已清 提交于 2019-12-23 04:08:04
问题 I'm new to Fluentd. I have one problem regarding the <match> tag and its format. For example Our system returns 2 different formats: format1 , and format2 at the same tag: tag Using fluent.conf we are able to catch the provided tag but we are unable to separate those two formats I tried the fluent-plugin-multi-format-parser but it does not allow me to add the prefixes. <match tag> @type parser format multi <pattern> format format1 add_prefix pattern1 ... </pattern> <pattern> format format2

How to use Fluent style syntactic sugar with c# property declaration

左心房为你撑大大i 提交于 2019-12-22 21:17:32
问题 I never used the fluent code style before. So this is hte first time I tried to develop something in the fluent style with a C# property declaration, but I get an error. Can anyone help me? public class MailTemplate { string _MailBody = ""; public MailTemplate MailBody { get { return _MailBody; } set { _MailBody = value ; } } string _Subject = ""; public MailTemplate Subject { get { return _Subject; } set { _Subject = value; } } string _MailFrom = ""; public MailTemplate MailFrom { get {

How to make update query with parameters and CASE statement in Laravel 4

微笑、不失礼 提交于 2019-12-22 20:44:49
问题 I'm trying to create mysql UPDATE query that will take parameters. In addition I want to append to the end of the field if the field isnt empty. For that I'm using CASE statement. Here's my query in doctrine (from silex): $query = "UPDATE table SET filed = ( CASE WHEN field = '' THEN :param1 ELSE concat(field, :param1) END) WHERE id=:param2"; $app['db']['test_db']->executeUpdate($sql, array('param1' => $user_text, 'param2' => $selected_id)); Now I want to convert it to fluent or raw query so

How to make update query with parameters and CASE statement in Laravel 4

半世苍凉 提交于 2019-12-22 20:43:09
问题 I'm trying to create mysql UPDATE query that will take parameters. In addition I want to append to the end of the field if the field isnt empty. For that I'm using CASE statement. Here's my query in doctrine (from silex): $query = "UPDATE table SET filed = ( CASE WHEN field = '' THEN :param1 ELSE concat(field, :param1) END) WHERE id=:param2"; $app['db']['test_db']->executeUpdate($sql, array('param1' => $user_text, 'param2' => $selected_id)); Now I want to convert it to fluent or raw query so

How to ensure the sequence of methods in fluent API?

蹲街弑〆低调 提交于 2019-12-22 10:39:34
问题 I want to create fluent interface for some of my classes that I am building as part of a framework. I have created the methods and I am able to successfully chain methods. Now I want to ensure that I can handle the improper sequence of method calls. The thing I am doing is something like CreateWorkflow -> OpenConfiguration -> ChangeUserName In the above scenario it wouldn't make sense if ChangeUserName was called first because it is dependent on OpenConfiguration. I am confused whether I am

Fluent NHibernate: Mixing Automapping and manual mapping

久未见 提交于 2019-12-22 04:45:12
问题 If using Fluent NHibernate, is it possible to automap most classes, but specify that a couple of particular classes should be mapped using the regular fluent API rather than being automapped? And if so, can anyone point me to some sample code that shows how to do it? Thanks! 回答1: It is possible and easy to mix-up mapping configurations: var cfg = Fluently.Configure() .Database(configurer) .Mappings(map => { // Automapping map.AutoMappings.Add(AutoMap.Assemblies(Assembly.GetExecutingAssembly()

Castle Windsor Fluent API: Define dependency explicitly

一世执手 提交于 2019-12-21 21:38:23
问题 Given the below configuration Container.Register(Component.For<A>().Named("foo")); Container.Register(Component.For<B>().Named("foobar")); Container.Register( AllTypes.Pick() .FromAssemblyNamed("MyAssembly") .If(t => t.Name.EndsWith("ABC")) .Configure(c => c.LifeStyle.Is(LifestyleType.Transient)) .WithService.Select(i => typeof(I)) ); Container.Register( AllTypes.Pick() .FromAssemblyNamed("MyAssembly") .If(t => t.Name.EndsWith("123")) .Configure(c => c.LifeStyle.Is(LifestyleType.Transient))

Doing joins with Fluent in a Vapor application

╄→гoц情女王★ 提交于 2019-12-21 21:34:28
问题 I'm struggling to figure out how to join my two tables together using fluent. In essence I want to run this SQL command: SELECT p.name, o.amount, o.amount * p.amount total FROM "OrderPoints" o INNER JOIN "Points" p ON o.points_id = p.id WHERE order_id = 10831 I've got my two models setup like so: final class OrderPoint: Codable, PostgreSQLModel, Content, Migration { var id: Int? = nil var orderID: Order.ID var pointID: Point.ID var amount: Double = 0 var point: Parent<OrderPoint, Point> {