|
//
// Parago Media GmbH & Co. KG, J�rgen B�urle (jbaurle@parago.de)
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System;
using System.IO;
using System.Web.Compilation;
using Parago.DALComp.Compiler;
namespace Parago.DALComp {
/// <summary>
/// Build provider to generate DAL code from source file with extension '.dal'.
/// The file gets compiled only within the application folder 'App_Code'.
/// </summary>
[BuildProviderAppliesTo(BuildProviderAppliesTo.Code)]
public class DALCompBuildProvider : BuildProvider {
public override void GenerateCode(AssemblyBuilder builder) {
// Read the source code file to compile (*.dal)
string source=String.Empty;
using(TextReader reader=OpenReader()) {
source=reader.ReadToEnd();
reader.Close();
}
// Tokenize, parse and generate DAL code and turn generated
// compile unit over to ASP.NET build process
Tokenizer tokenizer=new Tokenizer(source);
Parser parser=new Parser(tokenizer);
CodeGen codeGen=new CodeGen(parser);
builder.AddCodeCompileUnit(this, codeGen.Generate());
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.