public _P_NativeObjectMembersInitializator(System.Type type, StillOneScriptCore.EntityModel.LngObjectsModel.Support.Internal._I_P_NativeObject instance, MappingOption mappingOption, List<String> membersNames, StillOneScriptCore.Engine.IEnvironment environment) { this.mType = type; mInstance = instance; mMappingOption = mappingOption; mMembersNames = membersNames; mEnvironment = environment; InitInstance(); InitMembers(); }
public _P_NativeClass(System.Type type, MappingOption mappingOption, List<String> membersNames, StillOneScriptCore.Engine.IEnvironment environment) { if(type == null) { throw new ArgumentNullException("type"); } this.Environment = environment; mType = type; var tmpInitializator = new StillOneScriptCore.EntityModel.LngObjectsModel.Support.Internal._P_NativeObjectMembersInitializator(mType, this, mappingOption, membersNames, environment); }
public void Set(MappingOption opt, string[] symbols, params dynamic[] @params) { if (!MappingOptions.ContainsKey(opt)) { MappingOptions[opt] = new Dictionary <string, List <dynamic> >(); } foreach (var smb in symbols) { if (!MappingOptions[opt].ContainsKey(smb)) { MappingOptions[opt].Add(smb, @params.ToList()); } } }
public void Set(MappingOption opt, params dynamic[] @params) { switch (opt) { case MappingOption.LAND: IsLand = true; break; case MappingOption.PRIORITY: Priority = (double)@params[0]; break; case MappingOption.EXACTMATCH: ExactMatch = true; break; default: break; } }
public _P_NativeClass(System.Type type, MappingOption mappingOption, StillOneScriptCore.Engine.IEnvironment environment) : this(type, mappingOption, null, environment) { }
public void Clear(MappingOption opt) { MappingOptions.Remove(opt); }
public List <dynamic> GetParams(MappingOption opt, string symbol = GLOBAL_PARAMETERS_SYMBOL) { return(IsSet(opt, symbol) ? MappingOptions[opt][symbol] : new List <dynamic>()); }
public HashSet <string> GetSymbols(MappingOption opt) { return(IsSet(opt) ? new HashSet <string>(MappingOptions[opt].Keys) : new HashSet <string>()); }
public bool IsSet(MappingOption opt, string symbol = null) { return(MappingOptions.ContainsKey(opt) && (symbol == null || MappingOptions[opt].ContainsKey(symbol))); }
public MappingAttribute(MappingOption mappingOption, string mappingKey, string referenceStyle = "") { this.MappingOption = mappingOption; this.MappingKey = mappingKey; this.ReferenceStyle = referenceStyle; }
public CodeNamespace GenerateCode( string FileNamespace) { // Create the namespace Root = new CodeNamespace { Name = FileNamespace }; // Import namespaces Root.Imports.Add(new CodeNamespaceImport("System")); Root.Imports.Add(new CodeNamespaceImport("System.Collections")); Root.Imports.Add(new CodeNamespaceImport("System.Data")); Root.Imports.Add(new CodeNamespaceImport("System.Data.SqlClient")); Root.Imports.Add(new CodeNamespaceImport("System.Data.SqlTypes")); // Create class var Class = new CodeTypeDeclaration { Attributes = MemberAttributes.Public, IsClass = true, Name = Options.ClassName }; // When ParseNames is turned on, we store sub-classes here var Classes = new Dictionary <string, CodeTypeDeclaration>(); // Create constructor Class.Members.Add(new CodeConstructor { Attributes = MemberAttributes.Private }); // Add utility methods GenerateUtils(Class); // Add a method for each procedure foreach (Signature s in Signatures) { // build the regular and transacted versions var methodPlain = GenerateProcedureMethod( s, Options[s.FrameworkName], false); var methodTransacted = GenerateProcedureMethod( s, Options[s.FrameworkName], true); // can we find a mapping for this procedure? var methodName = methodPlain.Name; string className = null; MappingOption map = null; foreach (var mo in Options.Mappings) { if (mo.Match(s)) { map = mo; methodName = string.IsNullOrEmpty(map.Prefix) ? methodName : methodName.Substring(map.Prefix.Length); className = map.Class; break; } } if (null == map && Options.ParseNames) { // use pattern matching? if (null != Options.ParseNamesPattern) { var m = Options.ParseNamesPattern.Match(methodName); if (m.Success) { className = m.Groups["class"].Value; methodName = m.Groups["method"].Value; } } else if (methodName.StartsWith(Options.ParseNamesPrefix)) { // strip the prefix methodName = methodName.Substring(Options.ParseNamesPrefix.Length); // look for the deliminator var x = methodName.IndexOf(Options.ParseNamesDelim); if (-1 != x) { className = methodName.Substring(0, x); methodName = methodName.Substring(x + 1); } } } methodName = FormatIdentifier(Options, methodName); if (String.IsNullOrEmpty(className)) { // add methods to our top level class methodPlain.Name = methodName; methodTransacted.Name = methodName; Class.Members.Add(methodPlain); Class.Members.Add(methodTransacted); } else { // we found a mapping className = FormatIdentifier(Options, className); _AddMethodsToClass( Class, Classes, methodName, className, methodPlain, methodTransacted); } } // Add class to namespace Root.Types.Add(Class); return(Root); }
public _P_NativeInstance(object obj, MappingOption mappingOption, List<String> membersNames, StillOneScriptCore.Engine.IEnvironment environment) : this(obj, environment) { var tmpInitializator = new StillOneScriptCore.EntityModel.LngObjectsModel.Support.Internal._P_NativeObjectMembersInitializator(mType, this, mappingOption, membersNames, environment); }
public _P_NativeInstance(object obj, MappingOption mappingOption, StillOneScriptCore.Engine.IEnvironment environment) : this(obj, mappingOption, null, environment) { }