I wrote an e-commerce app and used SubSonic 2.2 to generate the Data-Access-Layer.
It works perfectly with Sql Server 2005 and 2008.
However I would like to add support for SQL Azure.
Does anyone know if the code generated by SubSonic 2.2 with work with SQL Azure?
Side note:
If there are big issues I may scrap the 2 yrs old Data-Access-Layer and use Telerik ORM.
thanks
I'm not that familiar with SQL Azure, but I understand it supports T-SQL. In that case, it shouldn't be too difficult to adapt SubSonic to it.
However, changing the template files will not be enough, you will need to modify the source project and rebuild it. I say this because the SubSonic dll contains references to the various ADO.Net providers it supports (Microsoft.Practices.EnterpriseLibrary.Data, MySql.Data, System.Data.SQLite, System.Data.SqlServerCe).
I would consider / strongly advise using something like EntityFramework which is fully supported. Other fully support ORMs include Lightspeed, nHibernate etc.
Related
I'm new to MVC, and my intention actually is to learn 'Code First' technique, using MVC 4. I'd been through several 'MVC 4 Entity Framework' tutorials, and no doubt, tutorials are really simple, and understandable. but for every tutorial I followd, the
EF will look for the database in the default location and if it doesn’t exist, it will create it for you
part is not working for me. Do i have to add ADO.net Entity framework model in project, and design the database entities firt? or am I missing something? It's been more than 15 days, & I'm stuck.
(I tried making database manually first, and it worked perfect. But I want to learn, as described in tutorials, that databases are automatically created, if we mention the connection string, and EntityFramework finds out that path doesn't actually contains such database, so it creates one).
I'd been through several tutorials, let's say, I'm following THIS one.
(I'm using Visual Studio Express for web 2012, EF 5.0.0)
your question: Do i have to add ADO.net Entity framework model in project, and design the database entities firt?
yes, in code first approach you need to tell entity framework what tables you are going to create, you do it by creating poco classes(Plain old CLR Object). then in run time entity framework will create a model(witch is a xml file) and generate query according to that xml file then executes it. you can read more about that in [CSDL MSL CSDL][1]
so for summary you write your domain classes(poco classes) and ef will create db for you but btw there is another way where in entity framework code first witch is called [Code first to existing database][2]
[2]: http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx it revers engineer the databse and create model for you.
Do i have to add ADO.net Entity framework model in project, and design the database entities first?
This is really the more traditional approach, aptly called the database-first approach. The code-first approach is an alternative to the former. They mean exactly what they say. In the case of code-first the code is first written and in effect the database is generated automatically. In database approach, the database is first created then you can use EF to automatically generate the code required to handle the database, mainly CRUD and connection management.
The built-in scaffolder in ASP.NET MVC should work fine either in code-first or database-first as long as you have your models already established in your project. If you find the generated code too simplistic, an alternative scaffolder that you can use is CamoteQ - it is an online ASP.NET MVC scaffolding tool that is based in DDD principles and recognized patterns.
I am evaluating SubSonic for use in Phase 2 of a large project. This is an ASP.NET project, with 700 tables in a SQL Server database.
We are planning for our domain model to consist of POCO classes to assist with an offline access requirements we have. I believe that the SimpleRepository pattern would be among my best options.
Since I have a database already, however, the migration assistance doesn't help me. Are there T4 templates for SimpleRepository that I just overlooked? How do I 'turn off' migration? If I missed something in the Wiki, point me there, otherwise get me started and I'll write up a Wiki entry for y'all when we get there.
I'd suggest you look at the linq templates. They're generated from your database just like the ActiveRecord templates but give you POCOs instead.
Alternatively you can just use the simple templates and never run migrations, migrations only happen when you explicitly tell them to (by specifying SimpleRepositoryOptions.RunMigrations while creating your repository) so it's not so much that you need to turn them off, just don't turn them on.
our team is looking to use a code generation tool for the current sharepoint application we are working on. We want to be able to generate most of the stored procedures and business entities instead of having to write them from scratch. Any recommendation what is the best code generation tool to use with sharepoint projects. I am familiar with CodeSmith, but I wasn't sure if there are any better solutions out there for this.
Code generation is not really necessary for SharePoint, all the code is generated in the SharePoint .NET Libraries.
The formulation of your question implies quite serious misunderstandings about SharePoint and it's use of databases.
If you want to talk to a custom database through a generated Data Access Layer, I would say go for the ADO.NET Entity Framework (works with VS2008 SP1 and .NET 3.5 SP1 only though.
A custom solution would be LLBLGen Pro
I have been using subsonic and the issues i keep running into is with when i make schema changes, I have to recompile everything and at times subsonic does not recognise some of the schema changes.
Is there a better OR/M that i can use asp.net which is more efficient with working with schema changes
I never had any problems with class generation with SubSonic. Are you sure your schema is a good one? Do you follow the conventions? If some tables are not generated, you may be missing PKs, but if you look into the generated classes it will tell you (in a comment) that this is the case. That's all the advice that I can give based on the information provided by you. I still think it's not SubSonic that's the problem...
If you are using the BuildProvider there is known issues with that and you might have to edit the web.config sometimes for it to rebuild, you can also try using SubCommander (sonic.exe) to generate your classes for you.
You can also try NHibernate check out http://www.summerofnhibernate.com/
What Database are you using and what schema changes are not showing up. In my experience with SubSonic I have never had any schema changes not show up in the generated classes. The largest error that I have seen people make is to add a table to their database, run the SubCommander to generate their classes and then forget to include the generated class in their project.
The only other related issue I have seen people make is if you generate your classes in a seperate class and they are all generated in C# and the project that is using the classes is written in VB. VB can not read into a C# project so you first need to build your C# project to see the schema changes in your VB project. That is one of the limitations of VB.
I suggest LLBLGen PRO. It is not free but well worth the $$$. I have been using it for more that 4 years on both web and windows applications.
Is it possible for subsonic to access dbo.sp_help_job?
SubSonic is an ORM tool that also wraps SP's but does not generate code for system SP's and the project is open source so you can edit the code to your need