This project is read-only.

SQL script

Mar 22, 2013 at 10:56 AM
Could you please add the SQL script
Mar 22, 2013 at 11:21 AM
Hello Prashantruat,

To create the database you need to first setup an SQL database and configure the FNHMVC.Test app.config to point there. You then can execute a test called CreateSchema. Basically all the database functions are setup as Unit Tests.

Once you do that don't forget to configure the web.config to point to this database.
Mar 22, 2013 at 11:41 AM
Forgot to mention that if you want the script the CreateSchema takes a string as a parameter that would return the SQLscript. There is also an UpdateSchema but don't expect to do what it says too well. I work with Redgate SQL Compare and SQL Data Compare to update schemas and move data between existing databases.
Mar 22, 2013 at 11:42 AM
Thanks, created database, Is the application using Simplemembership ?
Mar 22, 2013 at 11:54 AM
I use my own object implementation with a modified version of IFormsAuthentication.
Mar 22, 2013 at 12:15 PM
Trying to run application FNHMVC.Web, home page is coming up without any problem but as soon as i click on Register Link, gives an error "jQuery undefined" for jquery.validate.min.js. Am i missing something?
Also what if i need to add external authentication using OAuth(Google)/ OpenId(Microsoft), will i be able to use same infrastructure or my best bet will be using WebSecurity and EF.
I am taking reference of your project for building up authentication [Forms] for MVC4. I want to avoid Simplemembership [As much as possible], and will be using below for development
Windsor Castle for IoC
Being new to MVC 4 your input would be much appreciated.
Mar 22, 2013 at 12:31 PM
Which version did you download? Maybe you need compile and make sure the solutions has all the required packages, JQuery for example.

For external authentication I would use DotNetOpenAuth library which is included in version 2 of the framework. I would also modify the User object and continue using NHibernate. Why use EF when the solution is based in NHIbernate.

Finally if you want to replace Autofac (IoC) with Castle you are going to have a thought time since the whole solution uses Autofac everywhere.
Mar 22, 2013 at 12:44 PM
I have FNHMVC_2 opened, and i can see everything is in the project, looks like some jQuery thing is broken, will try to fix.

Basically i never worked with Autofac and till date i am working with Windsor castle only and very much comfortable using that, that's the only reason. Is that ok if i use ur code in my commercial application ?

Any possibility integrating OAuth or OpenId?
Mar 22, 2013 at 12:55 PM
Yes you can use the code in your own application. Only thing is if you improve things do include them in the original project.

I haven't integrated OpenDotNetAuth because of lack of time. I have it as a future task.
Mar 22, 2013 at 1:00 PM
Thanks, will definitely contribute, probably using windsor castle so others will have both options. Please update whenever you implement OpenDotNetAuth.
Mar 22, 2013 at 1:06 PM
I have played around with OpenDotNetAuth and it was just too broken. The problem is that everyone does what ever they want and not all OpenID or OAuth implementations are the same. So in the end you need a client for each provider and its just a pain to maintain each.
Mar 22, 2013 at 2:17 PM
Updated _Layout.cshtml with below code


    <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" />
    <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/themes/base/css")" rel="stylesheet" type="text/css" />

    <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script>*@
and Register.cshtml with

@Scripts.Render("~/bundles/jqueryval") @*<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>*@

And jquery error gone......
Aug 16, 2013 at 12:21 PM
Hi fabricio, i'm having the following problem.

I created the database, run the test and they run almost OK. Except for the Expense* ones...

The validate schema test fails and throws this error:
Test Name: ValidateSchema
Test FullName: FNHMVC.Test.DDLSchemaTools.ValidateSchema
Test Source: d:\Documentos\Visual Studio 2012\Projects\FastoCRM\src\FNHMVC.Test\DDLSchemaTools.cs : line 61
Test Outcome: Failed
Test Duration: 0:00:00.1251734

Result Message:
Test method FNHMVC.Test.DDLSchemaTools.ValidateSchema threw exception:
FluentNHibernate.Cfg.FluentConfigurationException: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.

---> NHibernate.HibernateException: Wrong column type in D:\DOCUMENTOS\VISUAL STUDIO 2012\PROJECTS\FASTOCRM\SRC\FNHMVC.WEB\APP_DATA\DATABASE.MDF.dbo.Expense for column Amount. Found: float, Expected DOUBLE PRECISION
Result StackTrace:
en NHibernate.Mapping.Table.ValidateColumns(Dialect dialect, IMapping mapping, ITableMetadata tableInfo)
en NHibernate.Cfg.Configuration.ValidateSchema(Dialect dialect, DatabaseMetadata databaseMetadata)
en NHibernate.Tool.hbm2ddl.SchemaValidator.Validate()
en FNHMVC.Data.SchemaTool.SchemaTool.<ValidateSchema>b__0(Configuration cfg) en d:\Documentos\Visual Studio 2012\Projects\FastoCRM\src\FNHMVC.Data\SchemaTool\SchemaTool.cs:línea 17
en FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
--- End of inner exception stack trace ---
en FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
en FNHMVC.Data.SchemaTool.SchemaTool.ValidateSchema(String ConnString) en d:\Documentos\Visual Studio 2012\Projects\FastoCRM\src\FNHMVC.Data\SchemaTool\SchemaTool.cs:línea 14
en FNHMVC.Test.DDLSchemaTools.ValidateSchema() en d:\Documentos\Visual Studio 2012\Projects\FastoCRM\src\FNHMVC.Test\DDLSchemaTools.cs:línea 62
The datatype created in the Expense table it's a float(53).

How can i fix this?

Great sample!, thanks
Aug 18, 2013 at 2:03 PM
Hello ironicnet,

I think your problem might be related to the configuration of NHibernate and the SQL server you are using. I'm not infront of my pc right now buy you need to look for the code line that specifies what sql server to use.