I have a website project, and using Linq to SQL in it. Currently, I have my .dbml file in the App_Code directory, but I want to separate it out into a different project in order to compile it into a separate dll; is it possible?
I tried adding a DB project to my solution, but didn't have much luck with it.
Yes, it is possible.
Just create a new project of type class library, and copy and paste your .dbml into the new project. Add a reference to the new project (class library) on your website project in the end.
I believe that a DB project is just a way to store SQL Scripts to be executed against a DB.
Related
I have an existing Spring MVC maven project. Everything in the current project is exactly what I need as a template for a new Spring project. Is there any way I can use the existing project as a template and rename it to a new project without changing anything but the name. I tried to recreate the existing project from scratch and just add the same existing components but am running into a lot of problems with the dependencies and other jar files as well as configurations.
I got it. All I did was select copy from the file menu and then it allowed me to rename it.
First select your project, click on the File option in side of the file choose rename option then you can change the project name.
I am currently making changes to a site but only have access to the files on the FTP, Is it possible to build a project file and solution from these files so that i can code and then republish and deploy?
I have a list of files including a bin and App_Code file along with all the pages, How do i create a project from this?
Thanks in Advance.
as much i know only you can do in this scenario that add all the dlls to your new project and use some OOPs concepts (like overloading, overriding etc) to use all the functionality of existing project.
happy coding :D
In my ASP.NET 4.0 WSP project, I'm using PetaPoco for most of the data access. I've successfully generated the classes from the Database using the T4 templates. But, by default, when you set install PetaPoco, the Database.tt file is in /Models/Generated. So, the resulting database.cs file is placed there. But, since I'm not compiling the project (since it's WSP), I can't use the database classes. I know I could manually move the generated database.cs file into App_Code to use it or move the database.tt file into App_Code and that would cause it to generate the database.cs in App_Code but I wanted to make sure to use the best approach and I'm not finding relevent content on the interwebs.
So, how should I handle this?
Moving the Database.tt to the App_Code folder is the right thing to do. There no much more magic than that.
I'm a newbie with ASP.NET web applications. When I create an ASP.NET web app project, there's a file called resources.resx in the folder My Project. Working in my computer I can access this file and its content without any problem. But when I deploy the application I can't access this file. I've tried copying the file seperately, and the folder (My Project) seperately, with the file in it, but no luck. Is there a way to achieve this?
PS: I've read something about implicit localization and explicit localization but I'd like to know if it can be done this way.
It's embedded into your DLL when you build (compile). So you can't change it when it's deployed.
If you want to see it in your DLL, you'll have to use a tool like Reflector, dotPeek, etc.
You can read more on resources here, starting from the 'Compiling Resources into Assemblies' title (as you know how to use them by now).
Well my suggestion is to use global and local resources.
In production you'll have resx file stored in:
App_GlobalResources: available in all application
App_LocalResources: one for each folder you want resources.
They are XML files visibile and editable.
I use it to allow me to modify string localization resources without recompiling and deploying.
And you can also give a web interface to the end user to allow him to self translate and localize strings at runtime.
I am converting an older C# Website Project into a Web Application Project so that we can better manage it in our source control system. I have run into a problem.
The Website Project used strongly-typed-datasets (i.e. .XSD files). There is C# code written that uses these strongly typed datasets as an object. That worked fine when it was a Website Project but does NOT compile now that it is a Web Application project. The compiler can not find the reference to the datas set because datasets are not compiled.
Is there an easy solution to this problem?
You could use XSD.exe on the command line to generate the dataset classes into a class file and add the file to the new project.
xsd.exe StronglyTypedDataset.xsd /dataset
This will generate the file "StronglyTypedDataset.cs". Use the /namespace:My.Project.Namespace flag if you need to put the dataset classes into a specific namespace.
This is essentially what's going on behind the scenes in your website project.
There's a nice guide to integrate XSD compiler into Visual Studio (2003 - 2010). It might help you automate the process: http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio#Visual_Studio_2010_.2810.0.29
Another approach that worked for me when converting into a Web Application Project was to remove the .xsd file from the project and include it again.
VS 2008 automatically defined the "Custom Tool" property to use (MSDataSetGenerator) and re-creates the *.designer.cs file for me every time the xsd change.