Code Monkey home page Code Monkey logo

microlite's People

Contributors

davidsteele avatar favill42 avatar jezza323 avatar mwhelan avatar pleb avatar slawomir-brzezinski-at-interxion avatar trevorpilley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microlite's Issues

Logging - configuration - app.config

log4net 1.2.10 now installed, but it's entry in app.config throws an exception in CreateSessionFactory.

@var configSection = ConfigurationManager.ConnectionStrings["blah"]; --> "Configuration system failed to initialize"

If I comment out the entry in app.config (and remove the logging-related code, but it's the entry that's the problem) it works as before.

Object cannot be cast from DBNull to other types.

FATAL - Object cannot be cast from DBNull to other types.
System.InvalidCastException: Object cannot be cast from DBNull to other types.
at System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvid
er provider)
at MicroLite.FrameworkExtensions.PropertyInfoExtensions.SetValueT(PropertyI
nfo propertyInfo, T instance, Object value) in c:\Source\GitHub\MicroLite\MicroL
ite\FrameworkExtensions\PropertyInfoExtensions.cs:line 55
at MicroLite.Core.ObjectBuilder.BuildNewInstanceT(IDataReader reader) in c:
\Source\GitHub\MicroLite\MicroLite\Core\ObjectBuilder.cs:line 46

Fetch, Querying

In the Wiki, it would be useful in the Fetch section to forward refer to the upcoming Querying section.
In the Querying section, it would be useful to remind the reader of the side-effect of not specifying all the columns.

Tidy up messages

Have 1 resources file in root namespace containing all messages.

Logging - log4net level ignored

I am using the simplest ConsoleAppender. App.config has <level value="XXX" etc. but it always behaves as if XXX = ALL.

<log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
        </layout>
    </appender>

    <root>
        <level value="FATAL"/>
    </root>
</log4net>

Session Advanced - Justification ?

'Delete by Identifier' is found in .Advanced but I don't really see the justification for what is considered 'Advanced' ? (Excellent general Wiki by the way !)

Refactor Configure class

Move the code for the .ForConnection().CreateSessionFactory() into a new object called FluentConfiguration, Configure.Fluently() should return a new instance of the new class.

This aligns the configuration of a connection with the way configuration of extensions is done.

Logging - configuration

I found that:
Configure
.Extensions()
.WithLog4Net()
did not show .WithLog4Net() in Intellisense, just .SetLogResolver

However:
sessionFactory = Configure
.Fluently()
.WithLog4Net()
.ForConnection("Blah")
.CreateSessionFactory();
was fine

Logging - configuration

public static readonly ILog log = LogManager.GetLogger(typeof(Program));

Configure
.Extensions()
.WithLog4Net();

Then, during sessionFactory = Configure etc., an exception is raised at
MicroLite.dll!MicroLite.Logging.LogManager.GetLog("MicroLite.Configure"): return GetLogger();

"Could not load file or assembly 'log4net' or dependency. The located assembly's manifest does not match the assembly reference"

GetLog should only be invoked if log is null ? Logging to console is operating successfully before the exception is raised.

LOG: Attempting download of (local path)\log4net.DLL
WRN: Comparing the assembly name resulted in the mismatch: Build number

This is probably to do with the way I have set up log4net, but any insight would be appreciated...

ObjectBuilder throws exception converting DBNull to nullable ValueType

InvalidCastException

Unable to cast object of type 'System.DBNull' to type 'System.ValueType'.

at MicroLite.FrameworkExtensions.PropertyInfoExtensions.SetValue[T](PropertyInfo propertyInfo, T instance, Object value)
at MicroLite.Core.ObjectBuilder.BuildNewInstance[T](IDataReader reader)

Updates to SqlBuilder

Move into MicroLite namespace.
Use casting to make it into an SqlQuery so we can loose the IToSqlQuery interface.
Move interfaces for fluent syntax for SqlBuilder into a MicroLite.Syntax namespace or somewhere.

ObjectBuilder throws exception converting int to nullable int

InvalidCastException

Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.

at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
at System.Int32.System.IConvertible.ToType(Type type, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at MicroLite.FrameworkExtensions.PropertyInfoExtensions.SetValue[T](PropertyInfo propertyInfo, T instance, Object value)
at MicroLite.Core.ObjectBuilder.BuildNewInstance[T](IDataReader reader)

Build error under Stylecop 4.7.30

15 occurrences of SA1311: Static readonly fields must start wit an upper-case letter

e.g. parameterRegex (2) in ConnectionManager.cs line 26

Others are log (5), orderByRegex, selectRegex, tableNameRegex, whereRegex, listenerFactories, listenerTypes, locker, objectInfos

Paged - PagedResult properties

The result object is a PagedResult which has 2 properties.

Page - This is the page number requested
Results - This is an IList of objects.

Question...
Should it have ResultsPerPage for completeness ?

ObjectInfo throws exception if identifier property is a reference type

MissingMethodException

No parameterless constructor defined for this object.

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at MicroLite.ObjectInfo.CaptureProperties()
at MicroLite.ObjectInfo..ctor(Type forType)
at MicroLite.ObjectInfo.For(Type forType)

Wiki: Query Builder

So the following query

.Where("Name = @p0", "Fred")
.AndWhere("StatusId = @p0", CustomerStatus.Active)
.OrWhere("StatusId = @p0", CustomerStatus.Disabled)
would produce the following SQL:

WHERE (Name = @p0) AND (StatusId = @p1) OR (StatusId = @p2)

I see what you mean, but it confused me at first. Maybe the last lines could read:

would translate to the following SqlQuery clause....

"...WHERE (Name = @p0) AND (StatusId = @p1) OR (StatusId = @p2)", "Fred", CustomerStatus.Active, CustomerStatus.Disabled

Review xml comments

Ensure that xml comments are descriptive and include exception details for any which can be thrown.

Two properties mapped to same Column

If one accidentally maps two properties to the same column, at Insert an exception is raised: "An item with the same key has already been added".

Update logging messages

Ensure that logging message are as meaningful as possible and use the correct logging level.

Committing transaction should close connection

If a transaction is not used, the connection is opened, the command executed and the command closed.
If a transaction is used, the call to BeginTransaction opens the connection, the commands are executed but the connection is not closed. This should happen upon commit or rollback.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.