コード例 #1
0
ファイル: Association.cs プロジェクト: jaseporter01/DNUG
        public static DynamicRepository RepositoryFor(string tableName)
        {
            var repo = new DynamicRepository(tableName);

            AssociationByConventions.ApplyProjection(repo);

            return(repo);
        }
コード例 #2
0
        public static DynamicRepository RepositoryFor(string tableName, string connectionString)
        {
            var repo = new DynamicRepository(new ConnectionProfile {
                ConnectionString = connectionString
            }, tableName);

            AssociationByConventions.ApplyProjection(repo, connectionString);

            return(repo);
        }
コード例 #3
0
ファイル: DynamicDb.cs プロジェクト: shaurya947/Loam
        dynamic MethodMissing(dynamic callInfo)
        {
            var tableName = callInfo.Name;

            if (!AssociationByConventions.TableExists(tableName, connectionString))
            {
                throw new AssociationByConventionsException("Table [" + tableName + "] doesn't exist.");
            }

            var repositoryProperty = tableName + "Repository";

            callInfo.Instance.SetMember(repositoryProperty, AssociationByConventions.RepositoryFor(tableName, connectionString));

            callInfo.Instance.SetMember(
                tableName,
                new DynamicFunction(() => callInfo.Instance.GetMember(repositoryProperty)));

            return(callInfo.Instance.GetMember(tableName)());
        }